django - Different templates usage caused by changing the order in URLs (auth / registration) -


i using in project built-in auth tools , django-registration

i have logout template at:

/accounts/templates/registration/logout.html 

if urls.py looks like:

urlpatterns = [ ... url(regex = r'^accounts/', view = include('registration.backends.hmac.urls')), url(regex = r'^accounts/', view = include('django.contrib.auth.urls')), ... ] 

it uses template. it's ok.

but if reorganize url like:

 urlpatterns = [ ... url(regex = r'^accounts/', view = include('django.contrib.auth.urls')), url(regex = r'^accounts/', view = include('registration.backends.hmac.urls')), ... ] 

it uses built-in admin logout template.

why happen?

edit

in their tutorial see 'registration.backends.hmac.urls':

that urlconf sets views django.contrib.auth (login, logout, password reset, etc.), though if want views @ different location, can include() urlconf registration.auth_urls place django.contrib.auth views @ specific location in url hierarchy.

but when open it, seems have no connection auth urls/views: edit: ok, see.

""" urlconf registration , activation, using django-registration's hmac activation workflow.  """  django.conf.urls import include, url django.views.generic.base import templateview .views import activationview, registrationview   urlpatterns = [ url(r'^activate/complete/$',     templateview.as_view(         template_name='registration/activation_complete.html'     ),     name='registration_activation_complete'), # activation key can make use of character # url-safe base64 alphabet, plus colon separator. url(r'^activate/(?p<activation_key>[-:\w]+)/$',     activationview.as_view(),     name='registration_activate'), url(r'^register/$',     registrationview.as_view(),     name='registration_register'), url(r'^register/complete/$',     templateview.as_view(         template_name='registration/registration_complete.html'     ),     name='registration_complete'), url(r'^register/closed/$',     templateview.as_view(         template_name='registration/registration_closed.html'     ),     name='registration_disallowed'), url(r'', include('registration.auth_urls')), 

]

the last url pattern in registration.backends.hmac.urls includes registration.auth_urls, provides urls login, logout , on.

url(r'', include('registration.auth_urls')), 

if include django.contrib.auth.urls, above hmac urls, logout view django.contrib.auth used. view uses different template, registration/logged_out.html. since haven't overridden this, admin template used.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -