Skip to content

Upgrade to Django 5.2 LTS - #638

Draft
leduythuccs wants to merge 7 commits into
masterfrom
thuc/5.2
Draft

Upgrade to Django 5.2 LTS#638
leduythuccs wants to merge 7 commits into
masterfrom
thuc/5.2

Conversation

@leduythuccs

Copy link
Copy Markdown
Contributor
  • upgrade: bump Django to 5.2 and social-auth packages
  • docs: update Django version references in settings.py comments
  • upgrade: replace unique_together with UniqueConstraint in 11 models
  • fix: replace django.utils.timezone.utc removed in Django 5.0

leduythuccs and others added 7 commits June 19, 2026 14:40
- Django>=4.2,<5 → Django>=5.2,<5.3 (unlock Django 5.2)
- social-auth-core==4.3.0 → >=4.5.4 (required by new social-auth-app-django)
- social-auth-app-django==5.0.0 → >=5.4.0 (5.0.0 only targeted Django 2.2–4.1;
  5.4.0 added official Django 5.x support)

Installed: Django 5.2.15, social-auth-core 4.9.1, social-auth-app-django 5.9.0
`python manage.py check` passes with no issues.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace djangoproject.com/en/4.2/ with /en/5.2/ in all six inline
documentation URL comments.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Django 4.2 deprecated Meta.unique_together (removal in Django 6.0).
Replace with UniqueConstraint in all 11 affected model classes:

- judge/models/tag.py: TagData
- judge/models/comment.py: CommentVote
- judge/models/submission.py: SubmissionTestCase
- judge/models/interface.py: BlogVote
- judge/models/profile.py: OrganizationMonthlyUsage
- judge/models/problem.py: ProblemTranslation, LanguageLimit
- judge/models/contest.py: ContestParticipation, ContestProblem, Rating, ContestMoss

Migration 0228 removes the unique_together records and adds equivalent
UniqueConstraint entries. No schema change — the underlying unique
indexes are preserved.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
django.utils.timezone.utc was removed in Django 5.0. Replace all
usages with the stdlib datetime.timezone.utc:

- judge/models/contest.py: ContestParticipation.pre_registered
- judge/views/contests.py: pre-registration sentinel datetime,
  iCalendar export (now, dtstart, dtend)
- judge/views/api/api_v2.py: make_aware fallback for naive timestamps

Add `timezone as dt_timezone` to datetime imports in contest.py
and contests.py; add `import datetime as dt` in api_v2.py.

Refs: Django 5.0 release notes — removed aliases section.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant