Skip to main content

Modify Django default User to use email as unique identifier

Project description

Django Custom Email User

Replacing the username with the email as the unique identifier is so common, that I simply decided to create a package to prevent this tedium again.

Used to replace default Django User model with email, instead of the username, as the unique identifer. The username is changed to optional and will not be requested as part of createsuperuser.

The Django admin panel is customised to accommodate these changes, along with the User forms custom_email_user.forms.CustomUserCreationForm and custom_email_user.forms.CustomUserChangeForm


  • add custom_email_user to your installed apps
  • subclass the abstracted class
  • configure the AUTH_USER_MODEL
  • run the migrations
  • register your user model with the admin site

AUTH_USER_MODEL = 'my_model_module.User'
from django.db import models
from custom_email_user.models import User as BaseUser

class User(BaseUser):
from django.contrib import admin
from custom_email_user.admin import CustomUserAdmin

from .models import User, CustomUserAdmin)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-custom-email-user, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size django_custom_email_user-0.1-py3-none-any.whl (5.5 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size django_custom_email_user-0.1.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page