Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrations for adjust datetimes: minor fixes #1397

Merged
merged 2 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion inyoka/forum/migrations/0019_adjust_datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
def adjust_post_datetime(apps, schema_editor):
post_model = apps.get_model("forum", "Post")

for p in post_model.objects.all():
for p in post_model.objects.all().order_by('-id'):
p.pub_date = p.pub_date.astimezone().replace(tzinfo=datetime.timezone.utc)
p.save(update_fields=["pub_date"])

Expand Down
2 changes: 2 additions & 0 deletions inyoka/planet/migrations/0006_adjust_datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ def adjust_blog_last_sync(apps, schema_editor):
blog_model = apps.get_model("planet", "Blog")

for b in blog_model.objects.all():
if not b.last_sync:
continue
b.last_sync = b.last_sync.astimezone().replace(tzinfo=datetime.timezone.utc)
b.save(update_fields=["last_sync"])

Expand Down
Loading