사용자를 로그인 (로그 아웃)하는 간단한 인증 시스템을 쓰고 있습니다. 사용자 이름은 전자 메일 주소를 조회하는 전자 메일 주소입니다.django에서 간단한 인증 시스템이 작동하지 않습니다.
내가 사용 :
User matching query does not exist.
내가하고 싶은 모든 경우에 볼 수 있습니다 : 사용자가 존재하는 경우
user = User.objects.get(email__exact=email)
# if user obj exists
if user:
# if authenticate
if authenticate(user, email, password):
# create session
request.session['user'] = user
# redir
return HttpResponseRedirect('/home/')
else:
return HttpResponseRedirect('/home/login/')
# no user obj found? (no email found actually)
else:
# redir
return HttpResponseRedirect('/home/')
는 사용자가 장고를 찾을 수없는 그러나 경우, 찾을에서 오류가 발생합니다 해당 쿼리는 결과와 일치합니다. 행을 어떻게 계산합니까?
잊어 버린 : after User.DoesNotExist – dotty
@dotty - 고마워, 난 항상 그랬어! –
나도 그래, 네 해결책이 최선이야. 고맙습니다. – dotty