mirror of
https://github.com/jazzband/django-admin2.git
synced 2026-03-16 22:20:24 +00:00
fix problems with permissions
This commit is contained in:
parent
d61b9922ce
commit
84ae23b903
1 changed files with 7 additions and 0 deletions
|
|
@ -344,6 +344,12 @@ class TemplatePermissionChecker(object):
|
|||
def __nonzero__(self):
|
||||
# if no view is bound we will return false, since we don't know which
|
||||
# permission to check we stay save in disallowing the access
|
||||
return self._cast_bool()
|
||||
|
||||
def __bool__(self):
|
||||
return self._cast_bool()
|
||||
|
||||
def _cast_bool(self):
|
||||
if self._view is None:
|
||||
return False
|
||||
if self._obj is None:
|
||||
|
|
@ -351,6 +357,7 @@ class TemplatePermissionChecker(object):
|
|||
else:
|
||||
return self._view.has_permission(self._obj)
|
||||
|
||||
|
||||
def __str__(self):
|
||||
if self._view is None:
|
||||
return ''
|
||||
|
|
|
|||
Loading…
Reference in a new issue