validation - Django - check if user has been redirected to current page -
I am using Django 1.5 and I want to know that the user has been redirected to my login page Because he tried to reach the other, the page requires login without logging in. Let's assume that this view is called 'Security Page' and assumes that when I enter
/ securityInfo /
Assume this is a security page:
@login_required def security page (request): #sm code
Now that I go to that URL, So it redirects me to Login.html page, which is correct (since the user - I - do not have - logged in to any account). This is my login.html:
{% if 'Next' is request.GET%} & lt; P & gt; You need to log in to your account before you reach that page that you were trying. View & lt; / P & gt; {% Endif%}
for some reason, I'm still being redirected and the URL of the login page is redirecting me
Http: //127.0.0.1:8000/login/?next=/securityInfo/
, line
{% if 'next' request.GET Is in)%}
is the 'next' in the URL, even if it evaluates. Any ideas why?
I do not think the request object is part of the default reference values.
Check your template_context_processors in your settings and if you add django.core.context_processors.request to that list, the current request will be added to each request in the convert text. Or just manually pass the request for that scene.
Comments
Post a Comment