diff --git a/djadmin2/permissions.py b/djadmin2/permissions.py index 9e11a75..849d465 100644 --- a/djadmin2/permissions.py +++ b/djadmin2/permissions.py @@ -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 ''