Skip to content

Commit 1d9fb4f

Browse files
mateuszmanderatimabbott
authored andcommitted
django: Upgrade Zulip to Django 3.2 LTS.
This is a straightforward upgrade in terms of changes needed. Necessary changes were: - Set `DEFAULT_AUTO_FIELD` https://docs.djangoproject.com/en/3.2/releases/3.2/#customizing-type-of-auto-created-primary-keys - `The default_app_config application configuration variable is deprecated, due to the now automatic AppConfig discovery.` https://docs.djangoproject.com/en/3.2/releases/3.2/#automatic-appconfig-discovery To handle this one, we can remove default_app_config from zerver/__init__.py because it satisfies what release notes describe in https://docs.djangoproject.com/en/3.2/releases/3.2/#automatic-appconfig-discovery: "Most pluggable applications define an AppConfig subclass in an apps.py submodule. Many define a default_app_config variable pointing to this class in their __init__.py. When the apps.py submodule exists and defines a single AppConfig subclass, Django now uses that configuration automatically, so you can remove default_app_config." An important note is that rebuild-test-database needs to be run after this upgrade in dev environment - if tests are run with test db that was built on the previous version, they will fail due to a mysterious bug (?), where changing attributes of a user and .save()ing after logging in in the test via self.login_user, causes getting logged out - the next requests via self.client_get etc. are unauthed for some reason, unless self.login_user is called again. This behavior is no longer exhibited upon rebuilding the test db - and I can't reproduce it in production or dev db. So this can likely be reasonably dismissed as some quirk of the test client system that won't be relevant in the future and doesn't impact production.
1 parent c285e3f commit 1d9fb4f

File tree

7 files changed

+10
-11
lines changed

7 files changed

+10
-11
lines changed

requirements/common.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# and requirements/prod.txt.
44
# See requirements/README.md for more detail.
55
# Django itself
6-
Django[argon2]==3.1.*
6+
Django[argon2]==3.2.*
77

88
# needed for Literal, TypedDict
99
typing-extensions

requirements/dev.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,9 @@ django-two-factor-auth[call,phonenumberslite,sms]==1.13.1 \
380380
--hash=sha256:a20e03d256fd9fd668988545f052cedcc47e5a981888562e5e27d0bb83deae89 \
381381
--hash=sha256:d270d4288731233621a9462a89a8dfed2dcb86fa354125c816a89772d55f9e29
382382
# via -r requirements/common.in
383-
django[argon2]==3.1.8 \
384-
--hash=sha256:c348b3ddc452bf4b62361f0752f71a339140c777ebea3cdaaaa8fdb7f417a862 \
385-
--hash=sha256:f8393103e15ec2d2d313ccbb95a3f1da092f9f58d74ac1c61ca2ac0436ae1eac
383+
django[argon2]==3.2 \
384+
--hash=sha256:0604e84c4fb698a5e53e5857b5aea945b2f19a18f25f10b8748dbdf935788927 \
385+
--hash=sha256:21f0f9643722675976004eb683c55d33c05486f94506672df3d6a141546f389d
386386
# via
387387
# -r requirements/common.in
388388
# django-auth-ldap

requirements/prod.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ django-two-factor-auth[call,phonenumberslite,sms]==1.13.1 \
244244
--hash=sha256:a20e03d256fd9fd668988545f052cedcc47e5a981888562e5e27d0bb83deae89 \
245245
--hash=sha256:d270d4288731233621a9462a89a8dfed2dcb86fa354125c816a89772d55f9e29
246246
# via -r requirements/common.in
247-
django[argon2]==3.1.8 \
248-
--hash=sha256:c348b3ddc452bf4b62361f0752f71a339140c777ebea3cdaaaa8fdb7f417a862 \
249-
--hash=sha256:f8393103e15ec2d2d313ccbb95a3f1da092f9f58d74ac1c61ca2ac0436ae1eac
247+
django[argon2]==3.2 \
248+
--hash=sha256:0604e84c4fb698a5e53e5857b5aea945b2f19a18f25f10b8748dbdf935788927 \
249+
--hash=sha256:21f0f9643722675976004eb683c55d33c05486f94506672df3d6a141546f389d
250250
# via
251251
# -r requirements/common.in
252252
# django-auth-ldap

tools/test-backend

-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ not_yet_fully_covered = [
7676
"zerver/lib/markdown/help_relative_links.py",
7777
"zerver/lib/markdown/nested_code_blocks.py",
7878
# Other lib files that ideally would coverage, but aren't sorted
79-
"zerver/__init__.py",
8079
"zerver/filters.py",
8180
"zerver/middleware.py",
8281
"zerver/lib/bot_lib.py",

version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@
4545
# historical commits sharing the same major version, in which case a
4646
# minor version bump suffices.
4747

48-
PROVISION_VERSION = "141.3"
48+
PROVISION_VERSION = "142.0"

zerver/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +0,0 @@
1-
# Load AppConfig app subclass by default on django applications initialization
2-
default_app_config = "zerver.apps.ZerverConfig"

zproject/computed_settings.py

+2
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ def get_dirs(self) -> List[PosixPath]:
315315

316316
POSTGRESQL_MISSING_DICTIONARIES = bool(get_config("postgresql", "missing_dictionaries", None))
317317

318+
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
319+
318320
########################################################################
319321
# RABBITMQ CONFIGURATION
320322
########################################################################

0 commit comments

Comments
 (0)