I have a base.html which has a login section at the top of every page.
If the user login fails on any page, I want to be able to redirect to that same page but to render the page with an error message to let the user know what went wrong.
I can see I can pass data back if I use render_to_response – then this data (login failed) can be checked in the template and, if set, used to show the error.
But since I want to redirect to whichever page the user was on in the first place, I can’t use render_to_response as it doesn’t know which template to render – so I have to use the redirect method. But with redirect, I can’t pass the error back to the template!
Any ideas on how I should go about this?
That’s what the messages framework is for.