JourneyJoker/clients/mixins.py

14 lines
No EOL
394 B
Python

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