Solution 1 :

You just need to create a variable that you can use to display the form. In your something simple like

request.session['pending']= true

Then in html you put the form within an if statement such as

{% if request.session.pending %} 
     blah blah
{% endif %}

Then back in your views, you set request.session[‘pending’]= false if the form is submitted or exited

Problem :

I’m working on a form which is rendered in all web site’s pages, I need that the server (Django) stops rendering this form on the web pages if the user closes or completes it. I’ve been reading about request.session but it does not clear the data when, for example, I restart the browser or clean the cache.

Any idea about how to do this? Thank you in advance!


Comment posted by VicenteC

The variable

Comment posted by dbrewster

how about request.session[‘pending’] ?