Skip to content

Commit

Permalink
Merge pull request #27 from biodiv/master
Browse files Browse the repository at this point in the history
compatibility with django 1.10, backwards compatible
  • Loading branch information
chrisglass authored Jan 13, 2018
2 parents 057f3ec + 3c3a4ec commit 708ff92
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions rulez/templatetags/rulez_perms.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@ def __init__(self, codename, objname, varname):
self.varname = varname

def render(self, context):
user_obj = template.resolve_variable('user', context)
obj = template.resolve_variable(self.objname, context)
try:
user_obj = template.resolve_variable('user', context)
except:
user_obj = template.Variable('user').resolve(context)
try:
obj = template.resolve_variable(self.objname, context)
except:
obj = template.Variable(self.objname).resolve(context)

context[self.varname] = user_obj.has_perm(self.codename, obj)
return ''

Expand Down

0 comments on commit 708ff92

Please sign in to comment.