From 95def9023e7b1a4ed2fac79478a3eb90b567edb0 Mon Sep 17 00:00:00 2001 From: zubairshakoorarbisoft Date: Fri, 15 Sep 2023 23:34:02 +0500 Subject: [PATCH] fix: Added support for django42 --- .github/workflows/ci.yml | 4 ++-- edx_exams/apps/core/admin.py | 16 +++++++--------- tox.ini | 4 ++-- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3bbd824f..32ca4d49 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: matrix: os: [ubuntu-20.04] python-version: ['3.8'] - toxenv: [django32, django40, quality, pii_check] + toxenv: [django32, django42, quality, pii_check] steps: - uses: actions/checkout@v2 @@ -38,7 +38,7 @@ jobs: run: tox - name: Run coverage - if: matrix.python-version == '3.8' && matrix.toxenv == 'django32' + if: matrix.python-version == '3.8' && matrix.toxenv == 'django42' uses: codecov/codecov-action@v1 with: flags: unittests diff --git a/edx_exams/apps/core/admin.py b/edx_exams/apps/core/admin.py index aabb365a..b726721d 100644 --- a/edx_exams/apps/core/admin.py +++ b/edx_exams/apps/core/admin.py @@ -17,6 +17,7 @@ ) +@admin.register(User) class CustomUserAdmin(UserAdmin): """ Admin configuration for the custom User model. """ list_display = ('username', 'email', 'full_name', 'first_name', 'last_name', 'is_staff') @@ -29,6 +30,7 @@ class CustomUserAdmin(UserAdmin): ) +@admin.register(ProctoringProvider) class ProctoringProviderAdmin(admin.ModelAdmin): """ Admin configuration for the Proctoring Provider model """ list_display = ('name', 'verbose_name', 'lti_configuration_id') @@ -36,6 +38,7 @@ class ProctoringProviderAdmin(admin.ModelAdmin): ordering = ('name',) +@admin.register(Exam) class ExamAdmin(admin.ModelAdmin): """ Admin configuration for the Exam model """ list_display = ('course_id', 'provider', 'exam_name', 'exam_type', 'due_date', 'is_active') @@ -46,6 +49,7 @@ class ExamAdmin(admin.ModelAdmin): ordering = ('-is_active', 'course_id', 'exam_name',) +@admin.register(ExamAttempt) class ExamAttemptAdmin(admin.ModelAdmin): """ Admin configuration for the Exam Attempt model """ list_display = ('user', 'exam', 'attempt_number', 'status', 'start_time', @@ -63,6 +67,7 @@ def change_view(self, request, object_id, form_url='', extra_context=None): ) +@admin.register(CourseExamConfiguration) class CourseExamConfigurationAdmin(admin.ModelAdmin): """ Admin configuration for the Course Exam Configuration model """ list_display = ('course_id', 'provider', 'allow_opt_out') @@ -71,6 +76,7 @@ class CourseExamConfigurationAdmin(admin.ModelAdmin): ordering = ('course_id',) +@admin.register(AssessmentControlResult) class AssessmentControlResultAdmin(admin.ModelAdmin): """ Admin configuration for the AssessmentControlResult model """ list_display = ('get_username', 'get_course_id', 'get_exam_name') @@ -87,18 +93,10 @@ def get_exam_name(self, obj): return obj.attempt.exam.exam_name +@admin.register(CourseStaffRole) class CourseStaffRoleAdmin(admin.ModelAdmin): """ Admin configuration for the Course Staff Role model """ list_display = ('user', 'course_id') list_filter = ('course_id',) search_fields = ('user__username', 'course_id') ordering = ('course_id',) - - -admin.site.register(User, CustomUserAdmin) -admin.site.register(ProctoringProvider, ProctoringProviderAdmin) -admin.site.register(Exam, ExamAdmin) -admin.site.register(ExamAttempt, ExamAttemptAdmin) -admin.site.register(CourseExamConfiguration, CourseExamConfigurationAdmin) -admin.site.register(AssessmentControlResult, AssessmentControlResultAdmin) -admin.site.register(CourseStaffRole, CourseStaffRoleAdmin) diff --git a/tox.ini b/tox.ini index 5983be05..f79a6c3a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py38-django{32,40}, quality, docs, pii_check +envlist = py38-django{32,42}, quality, docs, pii_check skipsdist = true [doc8] @@ -44,7 +44,7 @@ filterwarnings = [testenv] deps = django32: Django>=3.2,<4.0 - django40: Django>=4.0,<4.1 + django42: Django>=4.2,<4.3 -r{toxinidir}/requirements/test.txt commands = pytest {posargs}