Does Django ship with the authentication templates for use with the django.contrib.auth module? [duplicate] Does Django ship with the authentication templates for use with the django.contrib.auth module? [duplicate] django django

Does Django ship with the authentication templates for use with the django.contrib.auth module? [duplicate]


While the Django documentation explicitly states that "Django provides no default template for the authentication views", I found that it is trivial to use the admin templates. Just enable the admin app, then add this to urls.py:

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

All of the authentication urls work now, albeit with the Django admin look-and-feel.


You can use the auth templates at django.contrib.admin.templates.registration:

logged_out.htmlpassword_change_done.htmlpassword_change_form.htmlpassword_reset_complete.htmlpassword_reset_confirm.htmlpassword_reset_done.htmlpassword_reset_email.htmlpassword_reset_form.html

Those will have the look and feel of the Django Admin, so I would suggest to customize it.


By copying the templates located in django.contrib.admin.templates.registration as mentioned by DZPM above and placing them into your own registration app's templates directory e.g. *your_proj_root/registration/templates/registration/*

IMPORTANT! If you are keeping the same exact filenames for your templates, you have to remember to 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.