ernestophone.ens.fr/partitions/decorators.py
2015-03-17 19:03:51 +01:00

10 lines
240 B
Python

from django.contrib.auth.decorators import user_passes_test
def is_chef(user):
try:
profile = user.profile
return profile.is_chef
except:
return False
chef_required = user_passes_test(lambda u: is_chef(u))