ernestophone.ens.fr/partitions/decorators.py

20 lines
432 B
Python
Raw Normal View History

2015-03-17 19:03:51 +01:00
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))
2015-04-13 18:56:43 +02:00
def is_ernesto(user):
try:
profile = user.profile
return profile.is_ernesto
except:
return False
ernesto_required = user_passes_test(lambda u: is_ernesto(u))