0
可能重複:
login page redirect to main index pageDjango的頁面重定向登錄成功
我不是恰好有..實際上在重定向的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))
thanx提前。
你可以編輯你的問題來縮進四個空格的代碼,以便它是可讀的請。 – 2011-03-29 12:39:29
@Daniel Roseman看起來也是來自同一個用戶。 – 2011-03-29 12:43:55