Skip to content

feat!: Django 5.2 Upgrade #122

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 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

- name: Run Tests
run: docker exec -t analytics_api_testing bash -c "cd /edx/app/analytics_api/analytics_api/
&& export TOXENV=django42 && make test.requirements tox.requirements ${{ matrix.targets }}"
&& export TOXENV=django52 && make test.requirements tox.requirements ${{ matrix.targets }}"

- name: Run Coverage
if: matrix.python-version == '3.11' && matrix.targets=='main.test'
Expand Down
8 changes: 6 additions & 2 deletions analytics_data_api/v0/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ class CourseActivityWeekly(BaseCourseModel):

class Meta(BaseCourseModel.Meta):
db_table = 'course_activity'
index_together = [['course_id', 'activity_type']]
indexes = [
models.Index(fields=['course_id', 'activity_type']),
]
get_latest_by = 'interval_end'

interval_start = models.DateTimeField()
Expand All @@ -41,7 +43,9 @@ class BaseCourseEnrollment(BaseCourseModel):
class Meta(BaseCourseModel.Meta):
abstract = True
get_latest_by = 'date'
index_together = [('course_id', 'date',)]
indexes = [
models.Index(fields=['course_id', 'date']),
]


class CourseEnrollmentDaily(BaseCourseEnrollment):
Expand Down
12 changes: 11 additions & 1 deletion analyticsdataserver/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,11 +373,21 @@
]

# settings for report downloads
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
STORAGES = {
'default': {
'BACKEND': 'storages.backends.s3boto3.S3Boto3Storage',
},
'staticfiles': {
'BACKEND': 'django.contrib.staticfiles.storage.StaticFilesStorage',
},
}

MEDIA_ROOT = normpath(join(SITE_ROOT, 'static', 'reports'))
MEDIA_URL = 'http://localhost:8100/static/reports/'
COURSE_REPORT_FILE_LOCATION_TEMPLATE = '{course_id}_{report_name}.csv'
ENABLED_REPORT_IDENTIFIERS = ('problem_response',)
# For backwards compatibility of Report Download backend
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
REPORT_DOWNLOAD_BACKEND = {
DEFAULT_FILE_STORAGE: 'django.core.files.storage.FileSystemStorage',
MEDIA_ROOT: MEDIA_ROOT,
Expand Down
2 changes: 0 additions & 2 deletions analyticsdataserver/settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@

LMS_USER_ACCOUNT_BASE_URL = 'http://lms-host'

# Default the django-storage settings so we can test easily
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
AWS_ACCESS_KEY_ID = 'xxxxx'
AWS_SECRET_ACCESS_KEY = 'xxxxx'
AWS_STORAGE_BUCKET_NAME = 'fake-bucket'
Expand Down
16 changes: 7 additions & 9 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ asgiref==3.8.1
# django-countries
boto==2.49.0
# via -r requirements/base.in
boto3==1.38.19
boto3==1.38.23
# via -r requirements/base.in
botocore==1.38.19
botocore==1.38.23
# via
# boto3
# s3transfer
Expand All @@ -25,17 +25,17 @@ cffi==1.17.1
# pynacl
charset-normalizer==3.4.2
# via requests
click==8.2.0
click==8.2.1
# via edx-django-utils
coreapi==2.3.3
# via -r requirements/base.in
coreschema==0.0.4
# via coreapi
cryptography==45.0.2
cryptography==45.0.3
# via
# django-fernet-fields-v2
# pyjwt
django==4.2.21
django==5.2.1
# via
# -c requirements/constraints.txt
# -r requirements/base.in
Expand Down Expand Up @@ -105,7 +105,7 @@ edx-ccx-keys==2.0.2
# via -r requirements/base.in
edx-django-release-util==1.5.0
# via -r requirements/base.in
edx-django-utils==7.4.0
edx-django-utils==8.0.0
# via
# -r requirements/base.in
# edx-drf-extensions
Expand Down Expand Up @@ -154,8 +154,6 @@ markupsafe==3.0.2
# via jinja2
mysql-connector-python==9.3.0
# via edx-enterprise-data
newrelic==10.12.0
# via edx-django-utils
numpy==2.2.6
# via
# edx-enterprise-data
Expand Down Expand Up @@ -205,7 +203,7 @@ requests==2.32.3
# edx-rest-api-client
rules==3.5
# via edx-enterprise-data
s3transfer==0.12.0
s3transfer==0.13.0
# via boto3
semantic-version==2.10.0
# via edx-drf-extensions
Expand Down
6 changes: 1 addition & 5 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# linking to it here is good.

# TODO: Many pinned dependencies should be unpinned and/or moved to this constraints file.
django<4.3
django<5.3

# django-storages version 1.9 drops support for boto storage backend.
# pinning before django upgrade, will unpin after that
Expand All @@ -30,10 +30,6 @@ path<16.15.0
# dnspython 2.7.0 Requires-Python >=3.9
dnspython<2.7.0

# backports-zoneinfo comes by-default in newer versions of python
# it gives error while building wheel with python>=3.9
backports.zoneinfo ; python_version < "3.9"

# Cause: https://github.com/openedx/edx-lint/issues/458
# This can be unpinned once https://github.com/openedx/edx-lint/issues/459 has been resolved.
pip<24.3
16 changes: 7 additions & 9 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ asgiref==3.8.1
# django-countries
boto==2.49.0
# via -r requirements/base.in
boto3==1.38.19
boto3==1.38.23
# via -r requirements/base.in
botocore==1.38.19
botocore==1.38.23
# via
# boto3
# s3transfer
Expand All @@ -25,17 +25,17 @@ cffi==1.17.1
# pynacl
charset-normalizer==3.4.2
# via requests
click==8.2.0
click==8.2.1
# via edx-django-utils
coreapi==2.3.3
# via -r requirements/base.in
coreschema==0.0.4
# via coreapi
cryptography==45.0.2
cryptography==45.0.3
# via
# django-fernet-fields-v2
# pyjwt
django==4.2.21
django==5.2.1
# via
# -c requirements/constraints.txt
# -r requirements/base.in
Expand Down Expand Up @@ -105,7 +105,7 @@ edx-ccx-keys==2.0.2
# via -r requirements/base.in
edx-django-release-util==1.5.0
# via -r requirements/base.in
edx-django-utils==7.4.0
edx-django-utils==8.0.0
# via
# -r requirements/base.in
# edx-drf-extensions
Expand Down Expand Up @@ -156,8 +156,6 @@ mysql-connector-python==9.3.0
# via edx-enterprise-data
mysqlclient==2.2.7
# via -r requirements/dev.in
newrelic==10.12.0
# via edx-django-utils
numpy==2.2.6
# via
# edx-enterprise-data
Expand Down Expand Up @@ -207,7 +205,7 @@ requests==2.32.3
# edx-rest-api-client
rules==3.5
# via edx-enterprise-data
s3transfer==0.12.0
s3transfer==0.13.0
# via boto3
semantic-version==2.10.0
# via edx-drf-extensions
Expand Down
2 changes: 1 addition & 1 deletion requirements/django.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
django==4.2.21
django==5.2.1
16 changes: 7 additions & 9 deletions requirements/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ beautifulsoup4==4.13.4
# via pydata-sphinx-theme
boto==2.49.0
# via -r requirements/base.in
boto3==1.38.19
boto3==1.38.23
# via -r requirements/base.in
botocore==1.38.19
botocore==1.38.23
# via
# boto3
# s3transfer
Expand All @@ -35,17 +35,17 @@ cffi==1.17.1
# pynacl
charset-normalizer==3.4.2
# via requests
click==8.2.0
click==8.2.1
# via edx-django-utils
coreapi==2.3.3
# via -r requirements/base.in
coreschema==0.0.4
# via coreapi
cryptography==45.0.2
cryptography==45.0.3
# via
# django-fernet-fields-v2
# pyjwt
django==4.2.21
django==5.2.1
# via
# -c requirements/constraints.txt
# -r requirements/base.in
Expand Down Expand Up @@ -119,7 +119,7 @@ edx-ccx-keys==2.0.2
# via -r requirements/base.in
edx-django-release-util==1.5.0
# via -r requirements/base.in
edx-django-utils==7.4.0
edx-django-utils==8.0.0
# via
# -r requirements/base.in
# edx-drf-extensions
Expand Down Expand Up @@ -172,8 +172,6 @@ markupsafe==3.0.2
# via jinja2
mysql-connector-python==9.3.0
# via edx-enterprise-data
newrelic==10.12.0
# via edx-django-utils
numpy==2.2.6
# via
# edx-enterprise-data
Expand Down Expand Up @@ -240,7 +238,7 @@ roman-numerals-py==3.1.0
# via sphinx
rules==3.5
# via edx-enterprise-data
s3transfer==0.12.0
s3transfer==0.13.0
# via boto3
semantic-version==2.10.0
# via edx-drf-extensions
Expand Down
4 changes: 2 additions & 2 deletions requirements/pip.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ wheel==0.45.1
# The following packages are considered to be unsafe in a requirements file:
pip==24.2
# via
# -c /home/runner/work/edx-analytics-data-api/edx-analytics-data-api/requirements/constraints.txt
# -c requirements/constraints.txt
# -r requirements/pip.in
setuptools==80.7.1
setuptools==80.8.0
# via -r requirements/pip.in
2 changes: 1 addition & 1 deletion requirements/pip_tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
build==1.2.2.post1
# via pip-tools
click==8.2.0
click==8.2.1
# via pip-tools
packaging==25.0
# via build
Expand Down
18 changes: 8 additions & 10 deletions requirements/production.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ asgiref==3.8.1
# django-countries
boto==2.49.0
# via -r requirements/base.in
boto3==1.38.19
boto3==1.38.23
# via -r requirements/base.in
botocore==1.38.19
botocore==1.38.23
# via
# boto3
# s3transfer
Expand All @@ -25,17 +25,17 @@ cffi==1.17.1
# pynacl
charset-normalizer==3.4.2
# via requests
click==8.2.0
click==8.2.1
# via edx-django-utils
coreapi==2.3.3
# via -r requirements/base.in
coreschema==0.0.4
# via coreapi
cryptography==45.0.2
cryptography==45.0.3
# via
# django-fernet-fields-v2
# pyjwt
django==4.2.21
django==5.2.1
# via
# -c requirements/constraints.txt
# -r requirements/base.in
Expand Down Expand Up @@ -105,7 +105,7 @@ edx-ccx-keys==2.0.2
# via -r requirements/base.in
edx-django-release-util==1.5.0
# via -r requirements/base.in
edx-django-utils==7.4.0
edx-django-utils==8.0.0
# via
# -r requirements/base.in
# edx-drf-extensions
Expand Down Expand Up @@ -163,9 +163,7 @@ mysql-connector-python==9.3.0
mysqlclient==2.2.7
# via -r requirements/production.in
newrelic==10.12.0
# via
# -r requirements/production.in
# edx-django-utils
# via -r requirements/production.in
numpy==2.2.6
# via
# edx-enterprise-data
Expand Down Expand Up @@ -220,7 +218,7 @@ requests==2.32.3
# edx-rest-api-client
rules==3.5
# via edx-enterprise-data
s3transfer==0.12.0
s3transfer==0.13.0
# via boto3
semantic-version==2.10.0
# via edx-drf-extensions
Expand Down
Loading
Loading