From 308234166b71c24ac022e4e315453cd7a20dec0d Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Mon, 25 Apr 2022 22:00:15 -0500 Subject: [PATCH] Add reversion compare --- dmoj/settings.py | 1 + judge/admin/__init__.py | 1 + judge/admin/problem.py | 4 +++- judge/models/__init__.py | 5 +++++ requirements.txt | 1 + 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/dmoj/settings.py b/dmoj/settings.py index c01407d..634b6e4 100644 --- a/dmoj/settings.py +++ b/dmoj/settings.py @@ -234,6 +234,7 @@ INSTALLED_APPS += ( 'registration', 'mptt', 'reversion', + 'reversion_compare', 'django_social_share', 'social_django', 'compressor', diff --git a/judge/admin/__init__.py b/judge/admin/__init__.py index f079f32..67c778c 100644 --- a/judge/admin/__init__.py +++ b/judge/admin/__init__.py @@ -36,3 +36,4 @@ admin.site.register(ProblemType, ProblemTypeAdmin) admin.site.register(Profile, ProfileAdmin) admin.site.register(Submission, SubmissionAdmin) admin.site.register(Ticket, TicketAdmin) +admin.site diff --git a/judge/admin/problem.py b/judge/admin/problem.py index cb5bec4..a8e6c35 100644 --- a/judge/admin/problem.py +++ b/judge/admin/problem.py @@ -11,6 +11,8 @@ from django.urls import reverse_lazy from django.utils.html import format_html from django.utils.translation import gettext, gettext_lazy as _, ungettext from reversion.admin import VersionAdmin +from reversion_compare.admin import CompareVersionAdmin + from judge.models import LanguageLimit, Problem, ProblemClarification, ProblemTranslation, Profile, Solution from judge.widgets import AdminHeavySelect2MultipleWidget, AdminSelect2MultipleWidget, AdminSelect2Widget, \ @@ -117,7 +119,7 @@ class ProblemTranslationInline(admin.StackedInline): extra = 0 -class ProblemAdmin(VersionAdmin): +class ProblemAdmin(CompareVersionAdmin): fieldsets = ( (None, { 'fields': ( diff --git a/judge/models/__init__.py b/judge/models/__init__.py index a875103..c9c5db2 100644 --- a/judge/models/__init__.py +++ b/judge/models/__init__.py @@ -26,4 +26,9 @@ revisions.register(Solution) revisions.register(Judge, fields=['name', 'created', 'auth_key', 'description']) revisions.register(Language) revisions.register(Comment, fields=['author', 'time', 'page', 'score', 'body', 'hidden', 'parent']) +revisions.register(ProblemTranslation) +revisions.register(ProblemPointsVote) +revisions.register(ContestMoss) +revisions.register(ProblemData) +revisions.register(ProblemTestCase) del revisions diff --git a/requirements.txt b/requirements.txt index 5d84d30..dae6d6e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,7 @@ django-mptt django-pagedown<2 django-registration-redux django-reversion +django-reversion-compare django-social-share -e git://github.com/DMOJ/django-sortedm2m.git#egg=django-sortedm2m django-impersonate