From 8abd63966a1b6e350310865f573ff2e018d66b9d Mon Sep 17 00:00:00 2001 From: salmannawaz Date: Wed, 12 Jul 2023 15:01:37 +0500 Subject: [PATCH] Django 4.2 upgrade (#1134) * fix: django-4.2 upgrade --------- Co-authored-by: Salman Nawaz --- .github/workflows/ci.yml | 6 ++-- CHANGELOG.rst | 3 ++ edx_proctoring/__init__.py | 4 +-- edx_proctoring/admin.py | 12 +++---- edx_proctoring/tests/test_models.py | 3 +- package.json | 2 +- setup.py | 1 + test_urls.py | 3 +- tox.ini | 55 ++++++++++++++++------------- 9 files changed, 47 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1fd464d4979..469d62ae2d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,13 +22,15 @@ jobs: [ "django32-drflatest", "django40-drflatest", + "django42-drflatest", "quality", "pii_check", "version_check", "js_tests", "js_lint", "rst_validation", - "translations", + "translations-django32", + "translations-django42", ] steps: - uses: actions/checkout@v1 @@ -57,7 +59,7 @@ jobs: run: tox - name: Run Coverage - if: matrix.toxenv == 'django32-drflatest' + if: matrix.toxenv == 'django42-drflatest' uses: codecov/codecov-action@v3 with: flags: unittests diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e3bd109b366..794840f3d36 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,6 +13,9 @@ Change Log Unreleased ~~~~~~~~~~ +[4.16.0] - 2023-06-22 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* Support added for Django 4.2 [4.15.1] - 2023-04-19 ~~~~~~~~~~~~~~~~~~~~~ diff --git a/edx_proctoring/__init__.py b/edx_proctoring/__init__.py index b20fc3521ff..c211ad4e5a6 100644 --- a/edx_proctoring/__init__.py +++ b/edx_proctoring/__init__.py @@ -3,6 +3,4 @@ """ # Be sure to update the version number in edx_proctoring/package.json -__version__ = '4.15.1' - -default_app_config = 'edx_proctoring.apps.EdxProctoringConfig' # pylint: disable=invalid-name +__version__ = '4.16.0' diff --git a/edx_proctoring/admin.py b/edx_proctoring/admin.py index f0f014e4b39..5db62575073 100644 --- a/edx_proctoring/admin.py +++ b/edx_proctoring/admin.py @@ -43,6 +43,7 @@ class Meta: fields = '__all__' +@admin.register(ProctoredExam) class ProctoredExamAdmin(admin.ModelAdmin): """ Admin panel for Proctored Exams @@ -51,6 +52,7 @@ class ProctoredExamAdmin(admin.ModelAdmin): search_fields = ['course_id', 'exam_name'] +@admin.register(ProctoredExamReviewPolicy) class ProctoredExamReviewPolicyAdmin(admin.ModelAdmin): """ The admin panel for Review Policies @@ -244,6 +246,7 @@ def queryset(self, request, queryset): ) +@admin.register(ProctoredExamSoftwareSecureReview) class ProctoredExamSoftwareSecureReviewAdmin(admin.ModelAdmin): """ The admin panel for SoftwareSecure Review records @@ -320,6 +323,7 @@ def lookup_allowed(self, lookup, value): return super().lookup_allowed(lookup, value) +@admin.register(ProctoredExamSoftwareSecureReviewHistory) class ProctoredExamSoftwareSecureReviewHistoryAdmin(ProctoredExamSoftwareSecureReviewAdmin): """ The admin panel for SoftwareSecure Review records @@ -408,6 +412,7 @@ class Meta: status = forms.ChoiceField(choices=STATUS_CHOICES) +@admin.register(ProctoredExamStudentAttempt) class ProctoredExamStudentAttemptAdmin(SimpleHistoryAdmin): """ Admin panel for Proctored Exam Attempts @@ -495,10 +500,3 @@ def prettify_course_id(course_id): Prettify the COURSE ID string """ return course_id.replace('+', ' ').replace('/', ' ').replace('course-v1:', '') - - -admin.site.register(ProctoredExam, ProctoredExamAdmin) -admin.site.register(ProctoredExamStudentAttempt, ProctoredExamStudentAttemptAdmin) -admin.site.register(ProctoredExamReviewPolicy, ProctoredExamReviewPolicyAdmin) -admin.site.register(ProctoredExamSoftwareSecureReview, ProctoredExamSoftwareSecureReviewAdmin) -admin.site.register(ProctoredExamSoftwareSecureReviewHistory, ProctoredExamSoftwareSecureReviewHistoryAdmin) diff --git a/edx_proctoring/tests/test_models.py b/edx_proctoring/tests/test_models.py index 37f77b32319..f717bd3afa7 100644 --- a/edx_proctoring/tests/test_models.py +++ b/edx_proctoring/tests/test_models.py @@ -193,8 +193,7 @@ def test_get_practice_proctored_exams_for_course(self): ) self.assertQuerysetEqual( - ProctoredExam.get_practice_proctored_exams_for_course(course_id), - [repr(exam) for exam in practice_proctored_exams] + ProctoredExam.get_practice_proctored_exams_for_course(course_id), list(practice_proctored_exams) ) diff --git a/package.json b/package.json index b5359d58ecd..b8c07035208 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@edx/edx-proctoring", "//": "Note that the version format is slightly different than that of the Python version when using prereleases.", - "version": "4.15.1", + "version": "4.16.0", "main": "edx_proctoring/static/index.js", "scripts": { "test": "gulp test" diff --git a/setup.py b/setup.py index 75914fee418..6975ea35d94 100755 --- a/setup.py +++ b/setup.py @@ -73,6 +73,7 @@ def is_requirement(line): 'Framework :: Django', 'Framework :: Django :: 3.2', 'Framework :: Django :: 4.0', + 'Framework :: Django :: 4.2', 'Intended Audience :: Developers', 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)', 'Natural Language :: English', diff --git a/test_urls.py b/test_urls.py index 5feadff1d5a..50273539bed 100644 --- a/test_urls.py +++ b/test_urls.py @@ -1,10 +1,9 @@ from django.conf import settings -from django.conf.urls import include from edx_proctoring import views -from django.urls import path, re_path +from django.urls import include, path, re_path urlpatterns = [ path('', include('edx_proctoring.urls', namespace='edx_proctoring')), diff --git a/tox.ini b/tox.ini index 5e1ac64b451..0198c2fd1b7 100644 --- a/tox.ini +++ b/tox.ini @@ -1,80 +1,85 @@ [tox] -envlist = - py38-celery{50}-django{32, 40}-drflatest - quality, - version_check, - pii_check, - translations +envlist = + py38-celery{50}-django{32,40,42}-drflatest + quality, + version_check, + pii_check, + translations-django{32, 42} + [testenv] -deps = +deps = django32: Django>=3.2,<3.3 django40: Django>=4.0,<4.1 + django42: Django>=4.2,<4.3 drflatest: djangorestframework celery50: -r{toxinidir}/requirements/celery50.txt -rrequirements/test.txt -commands = +commands = python -Wd -m pytest {posargs:-n 3} [testenv:js_tests] -whitelist_externals = +whitelist_externals = npm make -commands = +commands = npm install -g gulp-cli npm install make test-js [testenv:js_lint] -whitelist_externals = +whitelist_externals = npm make -commands = +commands = npm install -g gulp-cli npm install make lint-js [testenv:rst_validation] -whitelist_externals = +whitelist_externals = make -deps = +deps = -r{toxinidir}/requirements/quality.txt -commands = +commands = make quality-rst [testenv:quality] -whitelist_externals = +whitelist_externals = make rm touch -deps = +deps = -r{toxinidir}/requirements/quality.txt -r{toxinidir}/requirements/test.txt -commands = +commands = pylint edx_proctoring pycodestyle edx_proctoring isort --check-only --diff edx_proctoring manage.py setup.py [testenv:version_check] -deps = +deps = -r{toxinidir}/requirements/base.txt -commands = +commands = {toxinidir}/edx_proctoring/scripts/version_check.py [testenv:pii_check] -whitelist_externals = +whitelist_externals = make -deps = +deps = -r{toxinidir}/requirements/test.txt Django>=3.2,<3.3 -commands = +commands = make pii_check [testenv:translations] -whitelist_externals = +whitelist_externals = make deps = + django32: Django>=3.2,<3.3 + django42: Django>=4.2,<4.3 -rrequirements/test.txt -commands = +commands = sudo apt-get update sudo apt-get install --no-install-recommends -y gettext make validate_translations +