Thursday, February 28, 2013

How to redirect to same page on failed login

Hi, I'm quite new to using Django, and I've searched around for a while for a solution but haven't really found anything useful.

I'm using a context processor to make my login form available from base.html. When I login in with valid details, it redirects me to the the page I logged in from as expected. However when I enter incorrect credentials it redirects me to /login/. I've tried using HttpResponse Redirect which will redirect me back to the referring page but then my form is empty so it no longer displays the field error messages. I've tried using render_to_response which gives me the field error messages but on /login/ rather than on the original page.

Any help would be much appreciated,

You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment