ernestophone.ens.fr/partitions/decorators.py

12 lines
241 B
Python
Raw Normal View History

2015-03-17 19:03:51 +01:00
from django.contrib.auth.decorators import user_passes_test
2015-03-17 19:03:51 +01:00
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))