academon/core/mixins/auth.py
2022-08-08 09:43:31 +00:00

12 lines
No EOL
334 B
Python

from django.contrib.auth.mixins import UserPassesTestMixin
from django.contrib import messages
class SuperuserRequiredMixin(UserPassesTestMixin):
def test_func(self):
return self.request.user.is_superuser
class StaffRequiredMixin(UserPassesTestMixin):
def test_func(self):
return self.request.user.is_staff