I'm trying to code a form in Django that redirect to itself, the display changing according to what you entered in the form. To do so, I retrieve the POST data in the backend and want to display a message this way: {% if message %} {{ message }} {% endif %}
The problem is how to pass the message
argument.
I know I could use
#urls.py
url(r'^form/(?P<message>)$', 'app.form', name='form')
#views.py
...my_message...
return HttpResponseRedirect(reverse('app:form', args=(my_message,))
but it would display the message in the url, which isn't suitable for my purpose. Would you know how I could do it and stay hidden in my backend, something like
#views.py
return HttpResponseRedirect(reverse('app:form'), {'message': my_message})
Use sessions to store the message - or even, the built-in messages framework.