當我登錄後重定向,或與用戶登錄時,它會返回到登錄屏幕,而不是下一個模板。有人可以告訴我我哪裏出錯了嗎?django重定向到其他網址
我的網址
urlpatterns = patterns('',
url(r'^$', views.login, name='login'),
url(r'^$', views.index, name='index'),
url(r'^logout/$', views.logout, name='logout'),
url(r'^register/$', views.register_user, name='register_user'),
)
我register_user觀點:
def register_user(request):
# False till someone fills in and sends
if request.method == "POST":
form = RegistrationForm(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect(reverse('index'))
else:
form = RegistrationForm()
return render_to_response('register.html', {'form': form},
context_instance=RequestContext(request))
現在,當我註冊的,而不是 '指數'
裝飾有'login_required'的'index'看法? – falsetru
此刻我的索引仍然是測試def索引(請求): \t return render(request,'index.html') –