-
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
ec1e98f
commit 1960c60
Showing
18 changed files
with
246 additions
and
166 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
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
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
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
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
71 changes: 71 additions & 0 deletions
71
etna/articles/migrations/0113_remove_articlepage_mark_new_on_next_publish_and_more.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,71 @@ | ||
# Generated by Django 5.1.2 on 2024-12-19 16:48 | ||
|
||
import django.utils.timezone | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("articles", "0112_alter_articlepage_body_alter_focusedarticlepage_body"), | ||
] | ||
|
||
def migrate_data(apps, schema_editor): | ||
Article = apps.get_model("articles.ArticlePage") | ||
FocusedArticle = apps.get_model("articles.FocusedArticlePage") | ||
RecordArticle = apps.get_model("articles.RecordArticlePage") | ||
for page in Article.objects.all(): | ||
if page.newly_published_at: | ||
page.published_date = ( | ||
page.newly_published_at | ||
or page.first_published_at | ||
or django.utils.timezone.now() | ||
) | ||
page.save() | ||
for page in FocusedArticle.objects.all(): | ||
if page.newly_published_at: | ||
page.published_date = ( | ||
page.newly_published_at | ||
or page.first_published_at | ||
or django.utils.timezone.now() | ||
) | ||
page.save() | ||
for page in RecordArticle.objects.all(): | ||
if page.newly_published_at: | ||
page.published_date = ( | ||
page.newly_published_at | ||
or page.first_published_at | ||
or django.utils.timezone.now() | ||
) | ||
page.save() | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="articlepage", | ||
name="published_date", | ||
field=models.DateTimeField( | ||
default=django.utils.timezone.now, | ||
help_text="The date the page was published to the public.", | ||
verbose_name="Published date", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="focusedarticlepage", | ||
name="published_date", | ||
field=models.DateTimeField( | ||
default=django.utils.timezone.now, | ||
help_text="The date the page was published to the public.", | ||
verbose_name="Published date", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="recordarticlepage", | ||
name="published_date", | ||
field=models.DateTimeField( | ||
default=django.utils.timezone.now, | ||
help_text="The date the page was published to the public.", | ||
verbose_name="Published date", | ||
), | ||
), | ||
migrations.RunPython(migrate_data), | ||
] |
38 changes: 38 additions & 0 deletions
38
etna/articles/migrations/0114_remove_articlepage_mark_new_on_next_publish_and_more.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,38 @@ | ||
# Generated by Django 5.1.2 on 2024-12-19 17:51 | ||
# etna:allowRemoveField | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("articles", "0113_remove_articlepage_mark_new_on_next_publish_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name="articlepage", | ||
name="mark_new_on_next_publish", | ||
), | ||
migrations.RemoveField( | ||
model_name="articlepage", | ||
name="newly_published_at", | ||
), | ||
migrations.RemoveField( | ||
model_name="focusedarticlepage", | ||
name="mark_new_on_next_publish", | ||
), | ||
migrations.RemoveField( | ||
model_name="focusedarticlepage", | ||
name="newly_published_at", | ||
), | ||
migrations.RemoveField( | ||
model_name="recordarticlepage", | ||
name="mark_new_on_next_publish", | ||
), | ||
migrations.RemoveField( | ||
model_name="recordarticlepage", | ||
name="newly_published_at", | ||
), | ||
] |
Oops, something went wrong.