Skip to content

Django 5 migration #483

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

Open
wants to merge 27 commits into
base: master
Choose a base branch
from

Conversation

Iteron-dev
Copy link
Member

Resolve #453.

@Iteron-dev Iteron-dev force-pushed the feature/django-5-migration branch from d0d121a to 9870e92 Compare March 12, 2025 14:44
@Iteron-dev Iteron-dev marked this pull request as ready for review April 15, 2025 23:14
@Iteron-dev Iteron-dev requested a review from twalen April 15, 2025 23:15
@Iteron-dev Iteron-dev self-assigned this Apr 15, 2025
Copy link
Member

@MasloMaslane MasloMaslane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few questions (in context of upgrading sio2.mimuw to Django 5):

  • why are some migrations changed? Is it possible to do this automatically?
  • should in every admin .short_description be replaced with @admin.display(description=...)?

from django.urls import re_path

from oioioi.workers import views

app_name = 'workers'

urlpatterns = [
re_path(r'^workers/$', views.show_info_about_workers, name='show_workers'),
path('workers/', views.show_info_about_workers, name='show_workers'),
re_path(r'^workers/load.json$', views.get_load_json, name='get_load_json'),
Copy link
Member

@MasloMaslane MasloMaslane Apr 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason this re_path is not changed?

Copy link
Member Author

@Iteron-dev Iteron-dev Apr 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was automatically made by django-upgrade. I could change the remaining re_path to path manually if needed.

@@ -0,0 +1,23 @@
# Generated by Django 4.2.20 on 2025-04-15 22:08
Copy link
Contributor

@twalen twalen Apr 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MasloMaslane This is the biggest concern in the migration to Django 5.2.
Due to change of index handling we need to fix the names of the indexes
(see https://adamj.eu/tech/2020/07/27/how-to-modernize-your-django-index-definitions/)

Default migration method requires long downtime due to rebuilding of the indexes, this suppose to be zero-downtime method, but we need to make sure that the "old_names" are correct.

@Iteron-dev
Copy link
Member Author

Iteron-dev commented Apr 16, 2025

@MasloMaslane

* should in every admin `.short_description` be replaced with `@admin.display(description=...)`?

It's a similar situation to re_path -> path - this change was automatically made by django-upgrade. Using the decorator instead of .short_description is the more modern approach, but the old way isn't deprecated.

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.

Django 5 migration
3 participants