Answer the question
In order to leave comments, you need to log in
Authorization in django?
When trying to log in using this method, it logs in, but before updating the page. Through the Django admin, the state is saved. What is missing?
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.sessions',
]
try:
request.GET['login']
user = auth.authenticate(
username=request.POST['username'],
password=request.POST['password'],
)
if user is not None:
if user.is_active:
login = auth.login(request, user)
except:
pass
if request.user.is_authenticated():
try:
request.GET['login']
return HttpResponseRedirect('')
except:
return render_to_response('billing/template.html', data)
else:
return render_to_response('auth.html', data)
Answer the question
In order to leave comments, you need to log in
At Dzhanga, the login is stored in sessions. So, it is request.GET['login']
not needed and is applicable only on the logging page. Yes, and there you can without it, and check everything through request.user.is_authenticated()
.
Good luck.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question