0👍
✅
The middleware is the way to go for this problem, it’s the only method that’s truly reliable and configurable.
1👍
Another option is to change LOGIN_REDIRECT_URL
to a view that does the check and redirects if required. However, users can then navigate away from the form by typing in another url.
If you absolutely require users to fill out the form, then using middleware is the way to do it.
- Django – Exclude superuser from LDAP auth
- Django dynamics ChoiceFields choices from APIs raises ValueError
- Access variables in the Redirect in django
- Raw Update Query inside a while loop in Django Python
- Attribute error 'LoginForm' object has no attribute 'cleaned_data' where login is carried out by mail and password
Source:stackexchange.com