Skip to content

Commit

Permalink
Merge pull request #274 from openedx/django42
Browse files Browse the repository at this point in the history
[Django 4.2]: Upgrade Django to 4.2
  • Loading branch information
macdiesel authored Oct 6, 2023
2 parents c439659 + 626d571 commit 8b3b803
Show file tree
Hide file tree
Showing 15 changed files with 178 additions and 108 deletions.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
push_translations start-devstack open-devstack pkg-devstack \
detect_changed_source_translations validate_translations check_keywords

COMMON_CONSTRAINTS_TXT=requirements/common_constraints.txt
.PHONY: $(COMMON_CONSTRAINTS_TXT)
$(COMMON_CONSTRAINTS_TXT):
wget -O "$(@)" https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt || touch "$(@)"

define BROWSER_PYSCRIPT
import os, webbrowser, sys
try:
Expand Down Expand Up @@ -101,8 +106,9 @@ subsidy_client_local: # re-install edx-enterprise-subsidy-client from local cod
pip uninstall -y edx-enterprise-subsidy-client && pip install -e /edx/src/edx-enterprise-subsidy-client/ && pip freeze | grep subsidy-client

upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
upgrade: piptools ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
upgrade: piptools $(COMMON_CONSTRAINTS_TXT) ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
# Make sure to compile files after any other files they include!
sed -i.tmp 's/Django<4.0//g' requirements/common_constraints.txt
pip-compile --allow-unsafe --rebuild --upgrade -o requirements/pip.txt requirements/pip.in
pip-compile --upgrade -o requirements/pip-tools.txt requirements/pip-tools.in
pip install -qr requirements/pip.txt
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Generated by Django 4.2.5 on 2023-09-21 09:20

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('subsidy_request', '0011_subsidy_request_course_partners_jsonfield'),
]

operations = [
migrations.AlterField(
model_name='couponcoderequest',
name='reviewer',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reviewed_%(app_label)s_%(class)s', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='couponcoderequest',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='licenserequest',
name='reviewer',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reviewed_%(app_label)s_%(class)s', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='licenserequest',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s', to=settings.AUTH_USER_MODEL),
),
]
5 changes: 5 additions & 0 deletions enterprise_access/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ def root(*path_fragments):

USE_TZ = True

# Django 4.0+ uses zoneinfo if this is not set. We can remove this and
# migrate to zoneinfo after Django 4.2 upgrade. See more on following url
# https://docs.djangoproject.com/en/4.2/releases/4.0/#zoneinfo-default-timezone-implementation
USE_DEPRECATED_PYTZ = True

LOCALE_PATHS = (
root('conf', 'locale'),
)
Expand Down
23 changes: 11 additions & 12 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ backoff==1.10.0
backports-zoneinfo[tzdata]==0.2.1
# via
# celery
# django
# kombu
billiard==4.1.0
# via celery
Expand All @@ -32,11 +33,11 @@ celery==5.3.4
# edx-celeryutils
certifi==2023.7.22
# via requests
cffi==1.15.1
cffi==1.16.0
# via
# cryptography
# pynacl
charset-normalizer==3.2.0
charset-normalizer==3.3.0
# via requests
click==8.1.7
# via
Expand All @@ -63,13 +64,12 @@ cryptography==41.0.4
# via
# pyjwt
# social-auth-core
defusedxml==0.7.1
defusedxml==0.8.0rc2
# via
# python3-openid
# social-auth-core
django==3.2.21
django==4.2.6
# via
# -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt
# -r requirements/base.in
# django-celery-results
# django-cors-headers
Expand Down Expand Up @@ -117,7 +117,7 @@ django-rest-swagger==2.2.0
# via -r requirements/base.in
django-simple-history==3.0.0
# via
# -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt
# -c requirements/common_constraints.txt
# -r requirements/base.in
django-waffle==4.0.0
# via
Expand Down Expand Up @@ -172,7 +172,7 @@ edx-rest-api-client==5.6.0
# via
# -r requirements/base.in
# edx-enterprise-subsidy-client
fastavro==1.8.3
fastavro==1.8.4
# via
# -r requirements/base.in
# openedx-events
Expand Down Expand Up @@ -214,9 +214,9 @@ oauthlib==3.2.2
# social-auth-core
openapi-codec==1.3.2
# via django-rest-swagger
openedx-events==8.6.0
openedx-events==8.8.0
# via -r requirements/base.in
packaging==23.1
packaging==23.2
# via drf-yasg
pbr==5.11.1
# via stevedore
Expand Down Expand Up @@ -252,7 +252,6 @@ python3-openid==3.2.0
pytz==2023.3.post1
# via
# -r requirements/base.in
# django
# djangorestframework
# drf-yasg
pyyaml==6.0.1
Expand Down Expand Up @@ -322,14 +321,14 @@ uritemplate==4.1.1
# coreapi
# drf-spectacular
# drf-yasg
urllib3==2.0.5
urllib3==2.0.6
# via requests
vine==5.0.0
# via
# amqp
# celery
# kombu
wcwidth==0.2.6
wcwidth==0.2.8
# via prompt-toolkit
zipp==3.17.0
# via importlib-resources
27 changes: 27 additions & 0 deletions requirements/common_constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# A central location for most common version constraints
# (across edx repos) for pip-installation.
#
# Similar to other constraint files this file doesn't install any packages.
# It specifies version constraints that will be applied if a package is needed.
# When pinning something here, please provide an explanation of why it is a good
# idea to pin this package across all edx repos, Ideally, link to other information
# that will help people in the future to remove the pin when possible.
# Writing an issue against the offending project and linking to it here is good.
#
# Note: Changes to this file will automatically be used by other repos, referencing
# this file from Github directly. It does not require packaging in edx-lint.


# using LTS django version


# elasticsearch>=7.14.0 includes breaking changes in it which caused issues in discovery upgrade process.
# elastic search changelog: https://www.elastic.co/guide/en/enterprise-search/master/release-notes-7.14.0.html
elasticsearch<7.14.0

# django-simple-history>3.0.0 adds indexing and causes a lot of migrations to be affected
django-simple-history==3.0.0

# tox>4.0.0 isn't yet compatible with many tox plugins, causing CI failures in almost all repos.
# Details can be found in this discussion: https://github.com/tox-dev/tox/discussions/1810
tox<4.0.0
3 changes: 2 additions & 1 deletion requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
# linking to it here is good.

# Common constraints for edx repos
-c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt
-c common_constraints.txt

28 changes: 14 additions & 14 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ backports-zoneinfo[tzdata]==0.2.1
# via
# -r requirements/validation.txt
# celery
# django
# kombu
billiard==4.1.0
# via
Expand All @@ -55,14 +56,14 @@ certifi==2023.7.22
# via
# -r requirements/validation.txt
# requests
cffi==1.15.1
cffi==1.16.0
# via
# -r requirements/validation.txt
# cryptography
# pynacl
chardet==5.2.0
# via diff-cover
charset-normalizer==3.2.0
charset-normalizer==3.3.0
# via
# -r requirements/validation.txt
# requests
Expand Down Expand Up @@ -110,7 +111,7 @@ coreschema==0.0.4
# via
# -r requirements/validation.txt
# coreapi
coverage[toml]==7.3.1
coverage[toml]==7.3.2
# via
# -r requirements/validation.txt
# pytest-cov
Expand All @@ -122,7 +123,7 @@ cryptography==41.0.4
# social-auth-core
ddt==1.6.0
# via -r requirements/validation.txt
defusedxml==0.7.1
defusedxml==0.8.0rc2
# via
# -r requirements/validation.txt
# python3-openid
Expand All @@ -137,7 +138,7 @@ distlib==0.3.7
# via
# -r requirements/validation.txt
# virtualenv
django==3.2.21
django==4.2.6
# via
# -r requirements/validation.txt
# django-celery-results
Expand Down Expand Up @@ -269,7 +270,7 @@ faker==19.6.2
# via
# -r requirements/validation.txt
# factory-boy
fastavro==1.8.3
fastavro==1.8.4
# via
# -r requirements/validation.txt
# openedx-events
Expand Down Expand Up @@ -396,9 +397,9 @@ openapi-codec==1.3.2
# via
# -r requirements/validation.txt
# django-rest-swagger
openedx-events==8.6.0
openedx-events==8.8.0
# via -r requirements/validation.txt
packaging==23.1
packaging==23.2
# via
# -r requirements/pip-tools.txt
# -r requirements/validation.txt
Expand All @@ -422,7 +423,7 @@ pkgutil-resolve-name==1.3.10
# via
# -r requirements/validation.txt
# jsonschema
platformdirs==3.10.0
platformdirs==3.11.0
# via
# -r requirements/validation.txt
# pylint
Expand Down Expand Up @@ -473,7 +474,7 @@ pyjwt[crypto]==2.8.0
# edx-drf-extensions
# edx-rest-api-client
# social-auth-core
pylint==2.17.6
pylint==2.17.7
# via
# -r requirements/validation.txt
# edx-lint
Expand Down Expand Up @@ -533,7 +534,6 @@ python3-openid==3.2.0
pytz==2023.3.post1
# via
# -r requirements/validation.txt
# django
# djangorestframework
# drf-yasg
pyyaml==6.0.1
Expand Down Expand Up @@ -579,7 +579,7 @@ rfc3986==2.0.0
# via
# -r requirements/validation.txt
# twine
rich==13.5.3
rich==13.6.0
# via
# -r requirements/validation.txt
# twine
Expand Down Expand Up @@ -684,7 +684,7 @@ uritemplate==4.1.1
# coreapi
# drf-spectacular
# drf-yasg
urllib3==2.0.5
urllib3==2.0.6
# via
# -r requirements/validation.txt
# requests
Expand All @@ -699,7 +699,7 @@ virtualenv==20.24.5
# via
# -r requirements/validation.txt
# tox
wcwidth==0.2.6
wcwidth==0.2.8
# via
# -r requirements/validation.txt
# prompt-toolkit
Expand Down
2 changes: 1 addition & 1 deletion requirements/django.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
django==3.2.21
django==4.2.6
Loading

0 comments on commit 8b3b803

Please sign in to comment.