From 84ae23b903f5a3a65660272cf8c634ea53584bd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Ga=C5=82uszka?= Date: Tue, 6 Jan 2015 18:29:29 +0100 Subject: [PATCH] fix problems with permissions --- djadmin2/permissions.py | 7 +++++++ 1 file changed, 7 insertions(+) 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 ''