django页面重定向成功登录

时间:2011-03-29 12:34:07

标签: django

  

可能重复:
  login page redirect to main index page

我没有完全准确..实际上在httpresponse重定向它没有显示任何内容。 实际上在显示我的登录页面的http://127.0.0.1:8000/login/上 现在我想要正确登录它将重定向到我的索引页面。 不确切的方式。

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 ) )

提前完成。

1 个答案:

答案 0 :(得分:0)

您可以使用LOGIN_REDIRECT_URL设置的默认登录处理程序。

相关问题