2010-07-29 29 views
12

Bir kullanıcı kayıt olmadığında sadece kimliği doğrulanmış kullanıcılar için site alanlarını girmeye çalışıyorum ?next= ile giriş siteme yönlendirilmem gerekiyor ve buradan ayarlarımdan LOGIN_REDIRECT_URL. Ancak, /accounts/login adres çubuğumda /users/login yerine görüntülenir. Doğru URL'yi almak için neleri değiştirmeliyim?Django kimlik doğrulaması - hatalı yönlendirme url giriş sayfasına

ayarları:

AUTH_PROFILE_MODULE = 'accounts.UserProfile' 
LOGIN_REDIRECT_URL = '/user/profile/' 

projenin URL'ler:

urlpatterns = patterns('', 
         url(r'^profile/$', profile_edit , name='user_profile'), 
         url(r'^friends_list/$', friends_list), 
         (r'', include('accounts.auth_urls')), 
         ) 

ve hesapları auth_urls.py (basitçe contrib.auth için url'lere:

import accounts.urls as regUrls 

urlpatterns = patterns("", 
         (...)      
         (r'^user/', include(regUrls)),      
         ) 

uygulama urls.py hesapları):

from django.conf.urls.defaults import * 
from django.views.generic.simple import direct_to_template 
from django.contrib.auth import views as auth_views 

    urlpatterns = patterns('', 
          url(r'^login/$', 
           auth_views.login, 
           {'template_name': 'user/login_logout_register/login.html'}, 
           name='auth_login'), 
          url(r'^logout/$', 
           auth_views.logout, 
           {'template_name': 'user/login_logout_register/logout.html'}, 
           name='auth_logout'),      
          url(r'^password/change/$', 
           auth_views.password_change, 
           {'template_name': 'user/login_logout_register/password_change_form.html'}, 
           name='auth_password_change'), 
          url(r'^password/change/done/$', 
           auth_views.password_change_done, 
           {'template_name': 'user/login_logout_register/password_change_done.html'}, 
           name='auth_password_change_done'),      
          url(r'^password/reset/$', 
           auth_views.password_reset, 
           {'template_name': 'user/login_logout_register/password_reset_form.html', 
           'email_template_name': 'user/login_logout_register/password_reset_email.html'}, 
           name='auth_password_reset'),      
          url(r'^password/reset/confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', 
           auth_views.password_reset_confirm, 
           {'template_name': 'user/login_logout_register/password_reset_confirm.html'}, 
           name='auth_password_reset_confirm'),      
          url(r'^password/reset/complete/$', 
           auth_views.password_reset_complete, 
           {'template_name': 'user/login_logout_register/password_reset_complete.html'}, 
           name='auth_password_reset_complete'),      
          url(r'^password/reset/done/$', 
           auth_views.password_reset_done, 
           {'template_name': 'user/login_logout_register/password_reset_done.html'}, 
           name='auth_password_reset_done'), 
          ) 

Daha fazla yapıştırma yapmam gerekiyorsa, söyle bana.

cevap

23

Siz de ayarlarında LOGIN_URL ayarlamanız gerekir:

LOGIN_URL = '/user/login' 
şimdi
+0

I got: 'http: // domain/kullanıcı/profil/sonraki =/kullanıcı/profil /% 3Fnext% 3D/kullanıcı/profile /% 253Fnext% 253D/kullanıcı/profil /% 25253 ... ':/ –

+0

LOGIN_URL,"/user/login "değil"/user/profile "olmalıdır. Sorunuzdaki cevapsız. Yukarıda güncellendi. – ars

İlgili konular