From fd21134dd66d3e0f4bea02d10ee3afcfb7b3b6bc Mon Sep 17 00:00:00 2001 From: Victor Fabre Date: Fri, 29 Jun 2018 15:59:02 -0300 Subject: [PATCH] Fix #2046 (#2047) * Fix #2046 * Add requirements --- requirements/requirements.txt | 1 + sapl/settings.py | 1 + sapl/utils.py | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 4b80ad130..6d9d79d66 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -36,3 +36,4 @@ django-reversion==2.0.8 WeasyPrint==0.42 whoosh==2.7.4 django-speedinfo==1.3.5 +django-reversion-compare==0.8.4 diff --git a/sapl/settings.py b/sapl/settings.py index ca24b9f02..72cf086cc 100644 --- a/sapl/settings.py +++ b/sapl/settings.py @@ -87,6 +87,7 @@ INSTALLED_APPS = ( 'sass_processor', 'rest_framework', 'reversion', + 'reversion_compare', 'whoosh', 'speedinfo', diff --git a/sapl/utils.py b/sapl/utils.py index b674481c3..89cf80f94 100644 --- a/sapl/utils.py +++ b/sapl/utils.py @@ -25,6 +25,7 @@ from django_filters.filterset import STRICTNESS from easy_thumbnails import source_generators from floppyforms import ClearableFileInput from reversion.admin import VersionAdmin +from reversion_compare.admin import CompareVersionAdmin from unipath.path import Path from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row @@ -228,7 +229,7 @@ def register_all_models_in_admin(module_name): appname = appname[1] if appname[0] == 'sapl' else appname[0] app = apps.get_app_config(appname) for model in app.get_models(): - class CustomModelAdmin(VersionAdmin): + class CustomModelAdmin(CompareVersionAdmin): list_display = [f.name for f in model._meta.fields if f.name != 'id']