Learn Django

Understanding the Auth System

Django comes with a built-in user authentication system. This system makes it easy to create users, help users login and logout of applications, give users permissions, define groups, and much more.

The most relevant parts of the user auth system in this chapter are the model and forms. The User model is a pre-built database table that stores the username, first name, last name, email, and password. When subscribers fill out the sign up form, the application will create a record in the User model. This record can then be easily referenced throughout the application to see if a particular user has access to certain pages and resources.

To make it easy to create and manage User records, the auth system has a set of pre-defined forms. The subscriber form in this project builds off one of these pre-defined forms. When used properly, this form will render the relevant HTML input fields on a page. It will also provide the proper validation when the form is submitted, such as making sure that the passwords match, and that the email address is in the right format.

Track your progress with a free account