Skip to content

Commit

Permalink
added django < 2.1 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Egor committed Nov 14, 2018
1 parent affb6d7 commit b893f66
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions reversion/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,14 @@ def recoverlist_view(self, request, extra_context=None):

def history_view(self, request, object_id, extra_context=None):
"""Renders the history view."""
# Check if user has change permissions for model
if not self.has_view_or_change_permission(request):
raise PermissionDenied
# Check if user has view or change permissions for model
if hasattr(self, 'has_view_or_change_permission'): # for Django >= 2.1
if not self.has_view_or_change_permission(request):
raise PermissionDenied
else:
if not self.has_change_permission(request):
raise PermissionDenied

opts = self.model._meta
action_list = [
{
Expand Down

0 comments on commit b893f66

Please sign in to comment.