from localauth.mixins import UserPassesTestMixin class PartnerProfileRequiredMixin(UserPassesTestMixin): def test_func(self): try: assert self.request.user.partnerprofile return True except: return False def get_login_url(self): return reverse_lazy("partners:register")