I use django-user-accounts app in my project. I can't understand strange behavior. When user try to login nothing happens. After successful login I want to redirect user. Why ACCOUNT_LOGIN_REDIRECT_URL setting don't work?
settings.py:
ACCOUNT_LOGIN_REDIRECT_URL = reverse_lazy('dashboard')
Also I tried to use LOGIN_REDIRECT_URL = reverse_lazy('dashboard') but result was the same.
urls.py:
url(r"^account/", include("account.urls")),
templates/account/login.html:
<form method="post" action="">
{% csrf_token %}
{% render_field form.username|add_class:"form-control" placeholder="Username" %}
{% render_field form.password|add_class:"form-control" placeholder="Password" %}
<input type="hidden" name="next" value="{{ next }}"/>
</form>
In console I see next:
[26/May/2018 14:31:38] "GET /account/login/ HTTP/1.1" 200 4018
Login redirect settings need to be a plain & simple string. Using
reversefor these doesn't work.Docs are here
If you need to do anything complicated with the redirect like figure out what user has logged in & redirect to a certain place then make the above setting a view that has the logic in it to do what you need to do.