-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
345db3b
commit 338b6b0
Showing
17 changed files
with
694 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
etna/articles/migrations/0098_alter_focusedarticlepage_author.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Generated by Django 4.2.5 on 2023-09-25 10:55 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
def convert_to_foreign_key(apps, schema_editor): | ||
FocusedArticlePage = apps.get_model("articles", "FocusedArticlePage") | ||
|
||
for page in FocusedArticlePage.objects.all(): | ||
if page.author: | ||
page.author = None | ||
page.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("authors", "0002_authorindexpage_authorpage_authortag_delete_author"), | ||
("articles", "0097_alter_articlepage_mark_new_on_next_publish_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(convert_to_foreign_key), | ||
migrations.AlterField( | ||
model_name="focusedarticlepage", | ||
name="author", | ||
field=models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="focused_articles", | ||
to="authors.authorpage", | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
195 changes: 195 additions & 0 deletions
195
etna/authors/migrations/0002_authorindexpage_authorpage_authortag_delete_author.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
# Generated by Django 4.2.5 on 2023-09-25 10:55 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import etna.analytics.mixins | ||
import modelcluster.fields | ||
import uuid | ||
import wagtail.fields | ||
import wagtailmetadata.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("images", "0008_alter_customimagerendition_file"), | ||
("wagtailcore", "0089_log_entry_data_json_null_to_object"), | ||
("authors", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="AuthorIndexPage", | ||
fields=[ | ||
( | ||
"page_ptr", | ||
models.OneToOneField( | ||
auto_created=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
parent_link=True, | ||
primary_key=True, | ||
serialize=False, | ||
to="wagtailcore.page", | ||
), | ||
), | ||
( | ||
"teaser_text", | ||
models.TextField( | ||
help_text="A short, enticing description of this page. This will appear in promos and under thumbnails around the site.", | ||
max_length=160, | ||
verbose_name="teaser text", | ||
), | ||
), | ||
( | ||
"uuid", | ||
models.UUIDField( | ||
default=uuid.uuid4, | ||
editable=False, | ||
unique=True, | ||
verbose_name="UUID", | ||
), | ||
), | ||
( | ||
"search_image", | ||
models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="+", | ||
to="images.customimage", | ||
verbose_name="Search image", | ||
), | ||
), | ||
( | ||
"teaser_image", | ||
models.ForeignKey( | ||
blank=True, | ||
help_text="Image that will appear on thumbnails and promos around the site.", | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="+", | ||
to="images.customimage", | ||
), | ||
), | ||
], | ||
options={ | ||
"abstract": False, | ||
}, | ||
bases=( | ||
wagtailmetadata.models.WagtailImageMetadataMixin, | ||
etna.analytics.mixins.DataLayerMixin, | ||
"wagtailcore.page", | ||
models.Model, | ||
), | ||
), | ||
migrations.CreateModel( | ||
name="AuthorPage", | ||
fields=[ | ||
( | ||
"page_ptr", | ||
models.OneToOneField( | ||
auto_created=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
parent_link=True, | ||
primary_key=True, | ||
serialize=False, | ||
to="wagtailcore.page", | ||
), | ||
), | ||
( | ||
"teaser_text", | ||
models.TextField( | ||
help_text="A short, enticing description of this page. This will appear in promos and under thumbnails around the site.", | ||
max_length=160, | ||
verbose_name="teaser text", | ||
), | ||
), | ||
( | ||
"uuid", | ||
models.UUIDField( | ||
default=uuid.uuid4, | ||
editable=False, | ||
unique=True, | ||
verbose_name="UUID", | ||
), | ||
), | ||
("role", models.CharField(blank=True, max_length=100, null=True)), | ||
("summary", wagtail.fields.RichTextField(blank=True, null=True)), | ||
( | ||
"image", | ||
models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="+", | ||
to="images.customimage", | ||
), | ||
), | ||
( | ||
"search_image", | ||
models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="+", | ||
to="images.customimage", | ||
verbose_name="Search image", | ||
), | ||
), | ||
( | ||
"teaser_image", | ||
models.ForeignKey( | ||
blank=True, | ||
help_text="Image that will appear on thumbnails and promos around the site.", | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="+", | ||
to="images.customimage", | ||
), | ||
), | ||
], | ||
options={ | ||
"verbose_name": "Author page", | ||
"verbose_name_plural": "Author pages", | ||
}, | ||
bases=( | ||
wagtailmetadata.models.WagtailImageMetadataMixin, | ||
etna.analytics.mixins.DataLayerMixin, | ||
"wagtailcore.page", | ||
models.Model, | ||
), | ||
), | ||
migrations.CreateModel( | ||
name="AuthorTag", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"author", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="author_pages", | ||
to="authors.authorpage", | ||
verbose_name="author", | ||
), | ||
), | ||
( | ||
"page", | ||
modelcluster.fields.ParentalKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="author_tags", | ||
to="wagtailcore.page", | ||
), | ||
), | ||
], | ||
), | ||
migrations.DeleteModel( | ||
name="Author", | ||
), | ||
] |
Oops, something went wrong.