I've got a site in Django/Django-CMS in which I want to save some data from one page to another. I'm saving the data in the session
variable:
request.session['yb_name'] = request.POST.get('name')
The problem is that sometimes my pages get and old value of yb_name
instead of the new one. I print the variable in my context processor and the value is the right one but in the template shows me and old one. This doesn't happen every time. Also this happens inside templates from custom plugins I've made.
I print it in the template like this:
<input type="text" name="name" value="{{ request.session.yb_name|default_if_none:'' }}">
The first thing that I tried was to delete the variable and then create it again the the new value:
if request.session.get('yb_name', None):
del request.session['yb_name']
request.session.modified = True
request.session['yb_name'] = request.POST.get('name')
request.session.modified = True
But the problem persists.
Any ideia what i could be?
Thanks :)