|
18 | 18 | from django.contrib.admin.utils import unquote
|
19 | 19 | except ImportError: # Django < 1.7
|
20 | 20 | from django.contrib.admin.util import unquote
|
| 21 | +try: |
| 22 | + from django.utils.version import get_complete_version |
| 23 | +except ImportError: |
| 24 | + from django import VERSION |
| 25 | + get_complete_version = lambda: VERSION |
21 | 26 |
|
22 | 27 | USER_NATURAL_KEY = tuple(
|
23 | 28 | key.lower() for key in settings.AUTH_USER_MODEL.split('.', 1))
|
@@ -75,8 +80,10 @@ def history_view(self, request, object_id, extra_context=None):
|
75 | 80 | 'admin_user_view': admin_user_view
|
76 | 81 | }
|
77 | 82 | context.update(extra_context or {})
|
78 |
| - return render(request, template_name=self.object_history_template, |
79 |
| - dictionary=context, current_app=request.current_app) |
| 83 | + extra_kwargs = {} |
| 84 | + if get_complete_version() < (1, 8): |
| 85 | + extra_kwargs['current_app'] = request.current_app |
| 86 | + return render(request, self.object_history_template, context, **extra_kwargs) |
80 | 87 |
|
81 | 88 | def response_change(self, request, obj):
|
82 | 89 | if '_change_history' in request.POST and SIMPLE_HISTORY_EDIT:
|
@@ -178,8 +185,10 @@ def history_form_view(self, request, object_id, version_id):
|
178 | 185 | 'save_on_top': self.save_on_top,
|
179 | 186 | 'root_path': getattr(self.admin_site, 'root_path', None),
|
180 | 187 | }
|
181 |
| - return render(request, template_name=self.object_history_form_template, |
182 |
| - dictionary=context, current_app=request.current_app) |
| 188 | + extra_kwargs = {} |
| 189 | + if get_complete_version() < (1, 8): |
| 190 | + extra_kwargs['current_app'] = request.current_app |
| 191 | + return render(request, self.object_history_form_template, context, **extra_kwargs) |
183 | 192 |
|
184 | 193 | def save_model(self, request, obj, form, change):
|
185 | 194 | """Set special model attribute to user for reference after save"""
|
|
0 commit comments