Does Django come with authentication templates for use with the django.contrib.auth module?

I found some of them in the tests directory, but I'm not sure if they are correct.

By authentication patterns, I mean login.htm , password_reset.htm , etc.

Some of the templates can be found at: http://devdoodles.wordpress.com/2009/02/16/user-authentication-with-django-registration/

+6
python django django-contrib
Jul 11 '11 at 6:14
source share
4 answers

No, he searches for these templates in the "registration" directory in your templates folder.

From the docs:

It is your responsibility to provide a default login form with the name registration / login.html.

Password Reset Additional arguments:

filename : The fully qualified name of the template used to display the Reset password form. By default, it will be registration/password_reset_form.html , if not specified.

Documents: login , password_reset

+5
Jul 11 '11 at 6:26
source share

While the Django documentation explicitly states that "Django does not provide a default template for authentication views," I found it trivial to use admin templates. Just enable the admin application and then add it to urls.py:

 url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'admin/login.html'}), url('^accounts/', include('django.contrib.auth.urls')), 

Now all authentication URLs work, albeit with the look of a Django administrator.

+16
May 19 '13 at
source share

You can use auth templates in django.contrib.admin.templates.registration :

 logged_out.html password_change_done.html password_change_form.html password_reset_complete.html password_reset_confirm.html password_reset_done.html password_reset_email.html password_reset_form.html 

They will have the look of Django Admin, so I would suggest tweaking it.

+5
Jul 11 '11 at 14:40
source share

By copying the templates located in django.contrib.admin.templates.registration as described above in DZPM, and placing them in your own directory of registration application templates, for example. * Your_proj_root / registration / templates / registration / *

IMPORTANT! If you keep the exact exact file names for your templates, you should remember that your django.contrib.admin application line is placed below your application registration line; otherwise, it will use the django.contrib.admin registration templates in preference.

+4
Aug 08 '11 at 13:50
source share



All Articles