Django Overwrite User Model

Do you want to learn how to overwrite the user model in django?

Welcome to the best play to learn it.

We need to do this before executing any command that affects our database because if we do it later it will place an error.

First step, create a new app with a common command: django-admin startproject user then add two lines on your settings.py.

# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
#New app
'user',
]

Then:

AUTH_USER_MODEL = 'user.MyUser'

MyUser is going to be your new user class.

That’s how you overwrite.

Thank you!!!.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store