成功登录时django页面重定向
可能重复: 我不太清楚。。实际上,在httpresponse重定向上,它什么也没有显示。 实际上在显示我的登录页面 现在我想在正确的登录它将重定向到我的索引页。 别照原样走成功登录时django页面重定向,django,Django,可能重复: 我不太清楚。。实际上,在httpresponse重定向上,它什么也没有显示。 实际上在显示我的登录页面 现在我想在正确的登录它将重定向到我的索引页。 别照原样走 def login(request): template = "../templates/admin/login.html" data = { } user = auth.authenticate(username='aa', password='bb') if user i
def login(request):
template = "../templates/admin/login.html"
data = {
}
user = auth.authenticate(username='aa', password='bb')
if user is not None and user.is_active:
template = "../templates/admin/index.html"
auth.login(request, user)
return HttpResponseRedirect("/login/index/")
return render_to_response( template, data,
context_instance = RequestContext( request ) )
thanx提前。您可以使用默认的登录处理程序和设置。您可以编辑您的问题,将代码缩进四个空格,以便可读。@Daniel Roseman似乎也是来自同一个用户。