Let me describe my scenario.
I got some views that I want to check two conditions before render:
1. user is logged in
2. user fulfilled account details form
If user is not logged in -> redirect to login page.
If user have not fulfilled its account details -> redirect to the form page.
I'm using the LoginRequiredMixin to check 1 and the UserPassesTest to check 2 and the problem is that both mixins use the same login_url attribute (or method if I implement get_login_url) and as my views include both mixins, it always takes the most-left mixin login_url.
Here's my code:
class LoginRequired(LoginRequiredMixin):
login_url = 'website:join'
redirect_field_name = None
class FulfillAccountRequired(UserPassesTestMixin):
login_url = 'website:account-detail'
def test_func(self):
...
class MyView(FulfillAccountRequired, LoginRequired, ListView):
...
Would be nice if there's a way to set a callable name for login_url (which after diving into mixins source I think is not possible).
Is there another clean way to go through?
Thanks,