File tree 4 files changed +28
-3
lines changed
4 files changed +28
-3
lines changed Original file line number Diff line number Diff line change 10
10
add_template_to_cache )
11
11
from dbtemplates .utils .template import check_template_syntax
12
12
13
- # Check if django-reversion is installed and use reversions' VersionAdmin
14
- # as the base admin class if yes
15
- if settings .DBTEMPLATES_USE_REVERSION :
13
+ # Check if either django-reversion-compare or django-reversion is installed and
14
+ # use reversion_compare's CompareVersionAdmin or reversion's VersionAdmin as
15
+ # the base admin class if yes
16
+ if settings .DBTEMPLATES_USE_REVERSION_COMPARE :
17
+ from reversion_compare .admin import CompareVersionAdmin as TemplateModelAdmin
18
+ elif settings .DBTEMPLATES_USE_REVERSION :
16
19
from reversion .admin import VersionAdmin as TemplateModelAdmin
17
20
else :
18
21
from django .contrib .admin import ModelAdmin as TemplateModelAdmin # noqa
Original file line number Diff line number Diff line change 10
10
class DbTemplatesConf (AppConf ):
11
11
USE_CODEMIRROR = False
12
12
USE_REVERSION = False
13
+ USE_REVERSION_COMPARE = False
13
14
USE_TINYMCE = False
14
15
USE_REDACTOR = False
15
16
ADD_DEFAULT_SITE = True
@@ -45,6 +46,13 @@ def configure_use_reversion(self, value):
45
46
"use of it in dbtemplates." )
46
47
return value
47
48
49
+ def configure_use_reversion_compare (self , value ):
50
+ if value and 'reversion_compare' not in settings .INSTALLED_APPS :
51
+ raise ImproperlyConfigured ("Please add 'reversion_compare' to your "
52
+ "INSTALLED_APPS setting to make "
53
+ "use of it in dbtemplates." )
54
+ return value
55
+
48
56
def configure_use_tinymce (self , value ):
49
57
if value and 'tinymce' not in settings .INSTALLED_APPS :
50
58
raise ImproperlyConfigured ("Please add 'tinymce' to your "
Original file line number Diff line number Diff line change @@ -61,8 +61,17 @@ Short installation howto
61
61
3. Sync your database with ``python manage.py syncdb``
62
62
4. Set ``DBTEMPLATES_USE_REVERSION`` setting to ``True``
63
63
64
+ History compare view
65
+ --------------------
66
+
67
+ You can also use ``dbtemplates`` together with `django-reversion-compare`_ which
68
+ provides a history compare view to compare two versions of a model which is under
69
+ reversion.
70
+
64
71
.. _django-reversion: https://github.com/etianen/django-reversion
65
72
.. _django-reversion's documentation: https://django-reversion.readthedocs.io/en/latest/
73
+ .. _django-reversion-compare: https://github.com/jedie/django-reversion-compare
74
+
66
75
67
76
.. _commands:
68
77
Original file line number Diff line number Diff line change @@ -41,6 +41,11 @@ Set to ``False`` by default.
41
41
42
42
A boolean, if enabled triggers the use of ``django-reversion``.
43
43
44
+ ``DBTEMPLATES_USE_REVERSION_COMPARE``
45
+ -----------------------------
46
+
47
+ A boolean, if enabled triggers the use of ``django-reversion-compare``.
48
+
44
49
``DBTEMPLATES_MEDIA_PREFIX``
45
50
----------------------------
46
51
You can’t perform that action at this time.
0 commit comments