真心求大神们百忙之中抽出点时间来帮下忙~~留QQ我加您!!
def login_(request):)<br>
username = request.POST.get('username', '')<br>
password = request.POST.get('password', ''))<br>
user = auth.authenticate(username=username, password=password)
if user is not None and user.is_active:)<br>
# Correct password, and the user is marked "active")<br>
auth.login(request,user))<br>
print user.is_authenticated)<br>
print request.user)<br>
# Redirect to a success page.)<br>
return HttpResponseRedirect("/index/"))<br>
else:)<br>
# Show an error page)<br>
return HttpResponseRedirect("/denglu/"))<br>
登陆成功后跳转到index页面 request.user.is_authenticated 没有值~~提示登陆失败<br>
{% if request.user.is_authenticated %<br>
<p>Welcome, {{ request.user.username }}. Thanks for logging in.</p><br>
{% else %}<br>
<p>Welcome, new user. Please log in.</p><br>
{% endif %}<br>