I came across Django Request.Session where, I know how to set and test it for a specific value.
request.session['name'] = "dummy"
and somewhere i check
if request.session['name'] == "dummy" :
#do something
But, now i have to check whether the session variable was even set in the first place? I mean how can i check whether there exists a value in the Request.Session['name'] Is set
?
Please can anyone tel me, is there a way to check it?
Thank you in advance.
Treat it as a Python dictionary:
if 'name' in request.session:
print request.session['name']
How to use sessions: http://docs.djangoproject.com/en/dev/topics/http/sessions/