DEV Community

besil
besil

Posted on

Django Customer User Model

Django - replace username as primary key with email

Django is a great tool, but nothing in this world is perfect.

Having a username could be fancy in the early web, but today, with tons of site and consequently credentials, people tend to simplify things to remember (at least, I do).

Generally, when I start a Django project I immediately create a Customer User Model (it's a Django best practice).

But the process is a bit tedious, because you have to:

  • Extend the Django User class
  • Modify settings.py to use the new user model
  • Configure the managers (or they will broke when you create user from cli)
  • Modify the admin view

You can skip to the official documentation and copy and paste based on your needs

Here are some useful links that helps me in this process:

Top comments (0)