JourneyJoker/clients/mixins.py

14 lines
394 B
Python
Raw Normal View History

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")