Meilleur décorateur

This commit is contained in:
Ludovic Stephan 2019-06-17 21:38:49 +02:00
parent 4f15b820a5
commit 46e7305953

View file

@ -60,6 +60,8 @@ def buro_required(view_func):
class CofRequiredMixin(PermissionRequiredMixin):
def has_permission(self):
if not self.request.user.is_authenticated:
return False
try:
return self.request.user.profile.is_cof
except AttributeError:
@ -68,6 +70,8 @@ class CofRequiredMixin(PermissionRequiredMixin):
class BuroRequiredMixin(PermissionRequiredMixin):
def has_permission(self):
if not self.request.user.is_authenticated:
return False
try:
return self.request.user.profile.is_buro
except AttributeError: