gestioCOF/gestioncof/decorators.py
2018-10-06 13:15:33 +02:00

23 lines
414 B
Python

from django.contrib.auth.decorators import user_passes_test
def is_cof(user):
try:
profile = user.profile
return profile.is_cof
except Exception:
return False
cof_required = user_passes_test(is_cof)
def is_buro(user):
try:
profile = user.profile
return profile.is_buro
except Exception:
return False
buro_required = user_passes_test(is_buro)