diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c37acb1..3007fb4 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -16,8 +16,7 @@ jobs:
os: [ubuntu-20.04]
python-version: ['3.8']
toxenv: [
- quality, docs, django32-drf312, django32-drf314,
- django40-drf312, django40-drf314
+ quality, docs, django32-drf314, django42-drf314
]
steps:
@@ -39,7 +38,7 @@ jobs:
run: tox
- name: Run Coverage
- if: matrix.python-version == '3.8' && matrix.toxenv=='django32-drf312'
+ if: matrix.python-version == '3.8' && matrix.toxenv=='django42-drf314'
uses: codecov/codecov-action@v1
with:
flags: unittests
diff --git a/submissions/__init__.py b/submissions/__init__.py
index f354922..a0ae12d 100644
--- a/submissions/__init__.py
+++ b/submissions/__init__.py
@@ -1,2 +1,2 @@
""" API for creating submissions and scores. """
-__version__ = '3.5.6'
+__version__ = '3.6.0'
diff --git a/submissions/admin.py b/submissions/admin.py
index c08a6df..3e354e9 100644
--- a/submissions/admin.py
+++ b/submissions/admin.py
@@ -16,18 +16,28 @@ class StudentItemAdminMixin:
'student_item__id'
)
+ @admin.display(
+ ordering='student_item__course_id'
+ )
def course_id(self, obj):
return obj.student_item.course_id
- course_id.admin_order_field = 'student_item__course_id'
+ @admin.display(
+ ordering='student_item__item_id'
+ )
def item_id(self, obj):
return obj.student_item.item_id
- item_id.admin_order_field = 'student_item__item_id'
+ @admin.display(
+ ordering='student_item__student_id'
+ )
def student_id(self, obj):
return obj.student_item.student_id
- student_id.admin_order_field = 'student_item__student_id'
+ @admin.display(
+ description='S.I. ID',
+ ordering='student_item__id',
+ )
def student_item_id(self, obj):
""" Formated student item id. """
url = reverse(
@@ -36,10 +46,8 @@ def student_item_id(self, obj):
)
return format_html(f'{obj.student_item.id}')
- student_item_id.admin_order_field = 'student_item__id'
- student_item_id.short_description = 'S.I. ID'
-
+@admin.register(StudentItem)
class StudentItemAdmin(admin.ModelAdmin):
list_display = ('id', 'course_id', 'item_type', 'item_id', 'student_id')
list_filter = ('item_type',)
@@ -47,6 +55,7 @@ class StudentItemAdmin(admin.ModelAdmin):
readonly_fields = ('course_id', 'item_type', 'item_id', 'student_id')
+@admin.register(Submission)
class SubmissionAdmin(admin.ModelAdmin, StudentItemAdminMixin):
""" Student Submission Admin View. """
list_display = (
@@ -83,6 +92,7 @@ class SubmissionInlineAdmin(admin.TabularInline, StudentItemAdminMixin):
extra = 0
+@admin.register(TeamSubmission)
class TeamSubmissionAdmin(admin.ModelAdmin):
""" Student Submission Admin View. """
@@ -92,6 +102,7 @@ class TeamSubmissionAdmin(admin.ModelAdmin):
inlines = (SubmissionInlineAdmin,)
+@admin.register(Score)
class ScoreAdmin(admin.ModelAdmin, StudentItemAdminMixin):
""" Student Score Admin View. """
list_display = (
@@ -114,6 +125,7 @@ def points(self, score):
return f"{score.points_earned}/{score.points_possible}"
+@admin.register(ScoreSummary)
class ScoreSummaryAdmin(admin.ModelAdmin, StudentItemAdminMixin):
""" Student Score Summary Admin View. """
list_display = (
@@ -127,25 +139,22 @@ class ScoreSummaryAdmin(admin.ModelAdmin, StudentItemAdminMixin):
)
exclude = ('highest', 'latest')
+ @admin.display(
+ description='Highest'
+ )
def highest_link(self, score_summary):
+ """Returns highest link"""
url = reverse(
'admin:submissions_score_change', args=[score_summary.highest.id]
)
return format_html(f'{score_summary.highest}')
- highest_link.short_description = 'Highest'
-
+ @admin.display(
+ description='Latest'
+ )
def latest_link(self, score_summary):
+ """Returns latest link"""
url = reverse(
'admin:submissions_score_change', args=[score_summary.latest.id]
)
return format_html(f'{score_summary.latest}')
-
- latest_link.short_description = 'Latest'
-
-
-admin.site.register(Score, ScoreAdmin)
-admin.site.register(StudentItem, StudentItemAdmin)
-admin.site.register(Submission, SubmissionAdmin)
-admin.site.register(TeamSubmission, TeamSubmissionAdmin)
-admin.site.register(ScoreSummary, ScoreSummaryAdmin)
diff --git a/tox.ini b/tox.ini
index 8c69f0f..281fced 100644
--- a/tox.ini
+++ b/tox.ini
@@ -7,8 +7,7 @@ setenv =
deps =
-r{toxinidir}/requirements/test.txt
django32: Django>=3.2,<4.0
- django40: Django>=4.0,<4.1
- drf312: djangorestframework<3.13.0
+ django42: Django>=4.2,<4.3
drf314: djangorestframework<3.15.0
commands =
python -Wd -m pytest {posargs}