from localauth.mixins import LoginRequiredMixin, UserPassesTestMixin class ClientProfileRequiredMixin(LoginRequiredMixin, UserPassesTestMixin): def test_func(self): try: assert self.request.user.clientprofile return True except: return False