I have a django website with many urls and views. Now I have asked to redirect all non-authenticated users to a certain landing page. So, all views must check if user.is_a
user.is_a
You can avoid specifying login_url by setting LOGIN_URL.
login_url
LOGIN_URL
In settings.py:
settings.py
LOGIN_URL = ''
In views.py:
views.py
@login_required def some_view_function(request):
If you need redirect within a view function, you can do so with:
return redirect_to_login(request.get_full_path())