ernestophone.ens.fr/gestion/mixins.py
2020-01-09 18:05:18 +01:00

7 lines
253 B
Python

from django.contrib.auth.mixins import UserPassesTestMixin
class ChefRequiredMixin(UserPassesTestMixin):
def test_func(self):
user = self.request.user
return (user is not None) and hasattr(user, "profile") and user.profile.is_chef