Skip to content Skip to sidebar Skip to footer

Django, Custom Login, Next Url Flushes After Login Attempt Fails

I need to use my own login template, with django.contrib.auth.login. I'm also trying to implement 'remember me' option, so I followed this snippet: https://djangosnippets.org/snipp

Solution 1:

Although this is an old post and by now I assume you've managed to solve it I would like to state one possible solution. You could change your template to look like:

<inputtype="hidden"name="next"value="{% if request.POST.next %}{{ request.POST.next }}{% else %}{{ request.GET.next }}{% endif %}"/>

I think this should solve the issue of the "next" page being lost.

Post a Comment for "Django, Custom Login, Next Url Flushes After Login Attempt Fails"