test_func()
You have to override the test_func()
method of the class to provide the test that is performed. Furthermore, you can set any of the parameters of AccessMixin
to customize the handling of unauthorized users:
from django.contrib.auth.mixins import UserPassesTestMixin class MyView(UserPassesTestMixin, View): def test_func(self): return self.request.user.email.endswith('@example.com')
Please login to continue.