Making a Custom Django User Model Tutorial

Table of Contents

Understanding the Django User model

The Django User model is at the center of Django’s authentication system. It is the mechanism for identifying the users of your web application.

A user will log in by providing their username and password. Then (depending on your authentication backend) the identity of that user is preserved across requests either through a session, a token, or some other mechanism.

When a request is made to your web application, Django loads an instance of the User model that represents (and identifies) the user of your web application.

Django User fields

All the fields on the built-in Django User model are used for authenticating the user, communicating with the user, and understanding what the user is authorized to access.

Authentication

  • username
  • password
  • last_login
  • date_joined

Communication

  • first_name
  • last_name
  • email

Authorization

  • groups
  • user_permissions
  • is_staff
  • is_active
  • is_superuser

Do I need a custom Django User model?

The short answer is: No, but use one anyway.

Back to Top