Django - Empty session data in ajax requests
- by ninja123
Hi guys, I have an ajax view where I want to set a session variable like such:
def upload(request, *args, **kwargs):
request.session['test'] = 'test'
request.session.modified = True
print request.session.items()
I have another normal view something like this:
def advertise(request):
print request.session.items()
I get these two strings printed to shell:
[('test', 'test')]
[('_auth_user_backend', 'django.contrib.auth.backends.ModelBackend'), ('_auth_user_id', 26L)]
Why is the session data that I set in the ajax view not passing to my regular views? If I set session data in regular view, everything works as fine, but it seems that ajax requests contain empty session data? Anybody dealt with something like this before? Any suggestions are greatly appreciated. Thanks.