from django import http def test(request): response = 'POST:' for k,v in request.POST.items(): response += '' % (k, v) response += '
%s%s
' response += 'Session:' for k,v in request.session._session.items(): response += '' % (k, v) response += '
%s%s
' response += '''
''' new_key = request.POST.get('new_key', False) new_value = request.POST.get('new_value', False) if new_key and new_value: request.session[new_key] = new_value return http.HttpResponse(response)