Skip to content

Commit 971d94a

Browse files
authored
Upgrade to Django 5.x (#12104)
Upgrade our code base to Django 5.2 - `django-safemigrate` had to be upgraded: you will find _a lot of_ changes like `Safe.before_deploy` -> `Safe.before_deploy()` (all of them are in this particular commit: 4273e83) - I had to borrow `django.core.files.storage.get_storage_class` because it was deleted from Django 5.2 - `assertFormError` tests were updated to match the new signature - `django-celery-beat` and `django-storages` were upgraded - Update some old migrations referring to indexes to make them work Closes #12079 Closes #11505
1 parent b4bdd3d commit 971d94a

File tree

337 files changed

+406
-386
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

337 files changed

+406
-386
lines changed

docs/dev/migrations.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ You can achieve this by following these steps:
4141
self.fields["new_field"].empty_value = False
4242
4343
#. Create the migration file (let's call this migration ``app 0001``),
44-
and mark it as ``Safe.before_deploy``.
44+
and mark it as ``Safe.before_deploy()``.
4545

4646
.. code-block:: python
4747
@@ -50,10 +50,10 @@ You can achieve this by following these steps:
5050
5151
5252
class Migration(migrations.Migration):
53-
safe = Safe.before_deploy
53+
safe = Safe.before_deploy()
5454
5555
#. Create a data migration to populate all null values of the new field with a proper value (let's call this migration ``app 0002``),
56-
and mark it as ``Safe.after_deploy``.
56+
and mark it as ``Safe.after_deploy()``.
5757

5858
.. code-block:: python
5959
@@ -66,14 +66,14 @@ You can achieve this by following these steps:
6666
6767
6868
class Migration(migrations.Migration):
69-
safe = Safe.after_deploy
69+
safe = Safe.after_deploy()
7070
7171
operations = [
7272
migrations.RunPython(migrate),
7373
]
7474
7575
#. After the deploy has been completed, create a new migration to set the field as non-nullable (let's call this migration ``app 0003``).
76-
Run this migration on a new deploy, you can mark it as ``Safe.before_deploy`` or ``Safe.always``.
76+
Run this migration on a new deploy, you can mark it as ``Safe.before_deploy()`` or ``Safe.always()``.
7777
#. Remove any handling of the null case from the code.
7878

7979
At the end, the deploy should look like this:
@@ -102,7 +102,7 @@ You can achieve this by following these steps:
102102
field_to_delete = models.CharField(max_length=100, null=True, blank=True)
103103
104104
#. Create the migration file (let's call this migration ``app 0001``),
105-
and mark it as ``Safe.before_deploy``.
105+
and mark it as ``Safe.before_deploy()``.
106106

107107
.. code-block:: python
108108
@@ -111,10 +111,10 @@ You can achieve this by following these steps:
111111
112112
113113
class Migration(migrations.Migration):
114-
safe = Safe.before_deploy
114+
safe = Safe.before_deploy()
115115
116116
#. Create a migration to remove the field from the database (let's call this migration ``app 0002``),
117-
and mark it as ``Safe.after_deploy``.
117+
and mark it as ``Safe.after_deploy()``.
118118

119119
.. code-block:: python
120120
@@ -123,7 +123,7 @@ You can achieve this by following these steps:
123123
124124
125125
class Migration(migrations.Migration):
126-
safe = Safe.after_deploy
126+
safe = Safe.after_deploy()
127127
128128
At the end, the deploy should look like this:
129129

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ filterwarnings =
2222
ignore:DateTimeField .* received a naive datetime .* while time zone support is active:RuntimeWarning
2323
ignore:.*:DeprecationWarning
2424

25-
ignore:.*:django.utils.deprecation.RemovedInDjango50Warning
25+
ignore:.*:django.utils.deprecation.RemovedInDjango60Warning
2626
ignore:.*:elasticsearch.exceptions.ElasticsearchWarning
2727
ignore:.*:PendingDeprecationWarning

readthedocs/analytics/migrations/0001_initial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
class Migration(migrations.Migration):
11-
safe = Safe.after_deploy
11+
safe = Safe.after_deploy()
1212
initial = True
1313

1414
dependencies = [

readthedocs/analytics/migrations/0002_track_status_code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
class Migration(migrations.Migration):
9-
safe = Safe.after_deploy
9+
safe = Safe.after_deploy()
1010
dependencies = [
1111
("builds", "0041_track_task_id"),
1212
("projects", "0087_use_booleanfield_null"),

readthedocs/analytics/migrations/0003_remove_index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
class Migration(migrations.Migration):
10-
safe = Safe.after_deploy
10+
safe = Safe.after_deploy()
1111
dependencies = [
1212
("analytics", "0002_track_status_code"),
1313
]

readthedocs/analytics/migrations/0004_merge_duplicate_records.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def forwards_func(apps, schema_editor):
2929

3030

3131
class Migration(migrations.Migration):
32-
safe = Safe.after_deploy
32+
safe = Safe.after_deploy()
3333
dependencies = [
3434
("analytics", "0003_remove_index"),
3535
]

readthedocs/analytics/migrations/0005_add_unique_constraint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
class Migration(migrations.Migration):
8-
safe = Safe.after_deploy
8+
safe = Safe.after_deploy()
99
dependencies = [
1010
("analytics", "0004_merge_duplicate_records"),
1111
]

readthedocs/analytics/migrations/0006_alter_pageview_id.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
class Migration(migrations.Migration):
8-
safe = Safe.after_deploy
8+
safe = Safe.after_deploy()
99
dependencies = [
1010
("analytics", "0005_add_unique_constraint"),
1111
]

readthedocs/analytics/migrations/0007_index_on_pageview_date.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
class Migration(migrations.Migration):
10-
safe = Safe.after_deploy
10+
safe = Safe.after_deploy()
1111
dependencies = [
1212
("analytics", "0006_alter_pageview_id"),
1313
]

0 commit comments

Comments
 (0)