Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I found some under the tests directory but I'm not sure if they are the right ones.

By authentication templates 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/

like image 603
Mridang Agarwalla Avatar asked Jul 11 '11 06:07

Mridang Agarwalla


People also ask

How does Django handle authentication?

The Django authentication system handles both authentication and authorization. Briefly, authentication verifies a user is who they claim to be, and authorization determines what an authenticated user is allowed to do. Here the term authentication is used to refer to both tasks.

What is Django contrib Auth models?

This is the default authentication backend used by Django. It authenticates using credentials consisting of a user identifier and password. For Django's default user model, the user identifier is the username, for custom user models it is the field specified by USERNAME_FIELD (see Customizing Users and authentication).

Does Django have authentication?

Django provides an authentication and authorization ("permission") system, built on top of the session framework discussed in the previous tutorial, that allows you to verify user credentials and define what actions each user is allowed to perform.

What is Django default authentication?

Authentication Views Django provides several views that you can use for handling login, logout, and password management. These make use of the stock auth forms but you can pass in your own forms as well. Django provides no default template for the authentication views.


1 Answers

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.

like image 95
Travis Avatar answered Oct 19 '22 16:10

Travis