1

I think I'm missing a little thing, but I don't know where.

Using django-registrationn, I've a urls config like that :

mysite/urls.py:

url(r'^accounts/', include('registration.backends.vince.urls')),

registration/backends/vince/urls.py:

urlpatterns = patterns('',
                   url(r'^activate/complete/$',
                       TemplateView.as_view(template_name='registration/activation_complete.html'),
                       name='registration_activation_complete'),
                   # Activation keys get matched by \w+ instead of the more specific
                   # [a-fA-F0-9]{40} because a bad activation key should still get to the view;
                   # that way it can return a sensible "invalid key" message instead of a
                   # confusing 404.
                   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'),
                   (r'', include('registration.auth_urls')),
                   )

and in registration/auth_urls.py :

urlpatterns = patterns('',
                   url(r'^login/$',
                       auth_views.login,
                       {'template_name': 'registration/login.html'},
                       name='auth_login'),
                   url(r'^logout/$',
                       auth_views.logout,
                       {'template_name': 'registration/logout.html'},
                       name='auth_logout'),
                   url(r'^password/change/$',
                       auth_views.password_change,
                       name='auth_password_change'),
                   url(r'^password/change/done/$',
                       auth_views.password_change_done,
                       name='auth_password_change_done'),
                   url(r'^password/reset/$',
                       auth_views.password_reset,
                       {'template_name': 'registration/password_reset_form.html'},
                       name='auth_password_reset'),

When I open my url /accounts/login, I get my template registration/login.html.

But when I request the /accounts/password/reset, I get the django's admin template, whereas I was waiting for the registration/password_reset_form.html

Can you help?

user777466
  • 991
  • 2
  • 13
  • 21
  • 1
    Your reset URL has a `"/"` at the end of it in `urls.py` but you don't have that in your example of `/accounts/password/reset`. Try adding the `/` at the end and see if it works. – themanatuf Oct 08 '13 at 13:57
  • I'm not sure if you made a typo in there or not, but you copied and pasted the same URL twice in your latest comment. – themanatuf Oct 08 '13 at 15:43
  • @themanatuf: there is no change. I get the same result if I try "/accounts/password/reset/" or "/accounts/password/reset" – user777466 Oct 08 '13 at 16:58
  • I see that you are not using namespacing for your views, which is something that Django suggests you do. It could be possible that `registration/password_reset_form.html` refers to a built in Django template. Have you tried a different file name? – dpk2442 Oct 08 '13 at 18:57
  • It works with a different file name! But I'm confused with the namespacing. When I add a namespace="accounts" in my root urls, everything goes down :( – user777466 Oct 09 '13 at 08:44

2 Answers2

1

This is the default

TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
)

To activate the filesystem.Loader you need to specify the dirs in TEMPLATE_DIRS

Andrea de Marco
  • 827
  • 5
  • 9
0

I have the same problem as you. There seems to be issues of incompatibility between Django 1.6/7 and django-registration.

EDIT: This single bit from Calvin Cheng worked for me:

...make sure that your django.contrib.admin app line is placed below your registration app line; otherwise, it will use the django.contrib.admin's registration templates in preference...

Community
  • 1
  • 1
BringBackCommodore64
  • 4,910
  • 3
  • 27
  • 30
  • Please include all the necessary details in your answer rather than linking to a resource outside the site. – tsnorri Mar 27 '15 at 15:11