2021-05-26 12:08:15 +00:00
|
|
|
from django.urls import reverse_lazy
|
|
|
|
|
2021-04-11 06:36:19 +00:00
|
|
|
from localauth.mixins import LoginRequiredMixin, UserPassesTestMixin
|
|
|
|
|
2021-05-26 12:08:15 +00:00
|
|
|
class ClientProfileRequiredMixin(UserPassesTestMixin):
|
2021-04-11 06:36:19 +00:00
|
|
|
def test_func(self):
|
|
|
|
try:
|
|
|
|
assert self.request.user.clientprofile
|
|
|
|
return True
|
|
|
|
except:
|
2021-05-26 12:08:15 +00:00
|
|
|
return False
|
|
|
|
|
|
|
|
def get_login_url(self):
|
|
|
|
return reverse_lazy("clients:register")
|