I have a page with a POST form that has an action set for some url.
Suppose this page URL is /form_url/ : ..
The view in /submit_url/ takes care of the form data. After that, I want to return the same form page with a successful message. In a view that takes over the POST form, I use HttpResponseRedirect to "clear" the form data from the browser. But in this way, I cannot display the message on the form page unless I do something like:
return HttpResponseRedirect("/form_url/?success=1")
and then check this option in the template. I donβt like this, because if the user refreshes the page, he will still see a success message.
I noticed that in the django admin site, deleting / adding objects uses a redirect after sending a POST and still displays a success message. How?
I have already briefly seen the django messaging application, but I want to know how it works in the first place.
post django forms message
user3599803
source share