Saving HTTP_REFERER in django
I have the following code in Django:
def signup(request)
http_referer = request.META.get('HTTP_REFERER','/')
if request.user.is_authenticated():
return HttpResponseRedirect(reverse('index'))
else:
if request.method == 'GET':
# return HttpResponse(http_referer) Here it returns the right
value
args={}
return render(request,'signup.html',args)
elif request.method =='POST':
# return HttpResponse(http_referer) Here it breaks and returns
current url
... actual code goes here, but this should be enough
I want to save the HTTP_REFERER for later use, because it is being
changed. I have tried storing it in variable, but somehow variable still
automaticlly changes. I guess i could try storing it temporarily in
database (it probably won't change there), but since I only need it in
that function and never again, that seems like a bad solution. Is there a
better way of doing this?
No comments:
Post a Comment