(2018-10-26) William S. Vincent => always use a custom user model

Advice

Django ships with a built-in User model for authentication, however the official Django documentation highly recommends using a custom user model for new projects.

The reason is if you want to make any changes to the User model down the road–for example adding a date of birth field–using a custom user model from the beginning makes this quite easy.

But if you do not, updating the default User model in an existing Django project is very, very challenging.

Warning

So always use a custom user model for all new Django projects.

1 # users/models.py
2 from django.contrib.auth.models import AbstractUser
3 from django.db import models
4
5 class CustomUser(AbstractUser):
6     # add additional fields in here
7
8     def __str__(self):
9         return self.email