from django.urls import reverse_lazy from localauth.mixins import LoginRequiredMixin, UserPassesTestMixin class ClientProfileRequiredMixin(UserPassesTestMixin): def test_func(self): try: assert self.request.user.clientprofile return True except: return False def get_login_url(self): return reverse_lazy("clients:register")