kpsul/gestioncof/decorators.py

24 lines
414 B
Python
Raw Normal View History

2017-03-20 04:11:50 +01:00
from django.contrib.auth.decorators import user_passes_test
2012-07-11 17:39:20 +02:00
2012-07-11 17:39:20 +02:00
def is_cof(user):
try:
profile = user.profile
2012-07-11 17:39:20 +02:00
return profile.is_cof
2018-10-06 12:47:19 +02:00
except Exception:
2012-07-11 17:39:20 +02:00
return False
2017-03-21 00:24:44 +01:00
cof_required = user_passes_test(is_cof)
2012-07-11 17:39:20 +02:00
def is_buro(user):
try:
profile = user.profile
2012-07-11 17:39:20 +02:00
return profile.is_buro
2018-10-06 12:47:19 +02:00
except Exception:
2012-07-11 17:39:20 +02:00
return False
2017-03-21 00:24:44 +01:00
buro_required = user_passes_test(is_buro)