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
Simply:
- 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
INSTALLED_APPS = [
...
'custom_email_user'
]
AUTH_USER_MODEL = 'my_model_module.User'
from django.db import models
from custom_email_user.models import User as BaseUser
class User(BaseUser):
pass
from django.contrib import admin
from custom_email_user.admin import CustomUserAdmin
from .models import User
admin.site.register(User, CustomUserAdmin)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django_custom_email_user-0.1.tar.gz
.
File metadata
- Download URL: django_custom_email_user-0.1.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4729c55e1819a4f86ef1fa026b841f759c51e06870ccaef9f3a56aaba7b7ee0 |
|
MD5 | 6c5150e32acfa33cf8825085d2e57671 |
|
BLAKE2b-256 | 6a74be76a00021edb494d72cf057cb182adcd2c0b4758bf8b0668a944fedd2d6 |
File details
Details for the file django_custom_email_user-0.1-py3-none-any.whl
.
File metadata
- Download URL: django_custom_email_user-0.1-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28a64805742bb5b5463ebfc59eb3989604b6386df6f8fd762ec064ad68e6c18b |
|
MD5 | a5268503f2fabe2b2b4ccd439973a53f |
|
BLAKE2b-256 | 04fbb6d1034853079fe8fb5ec2af58d2e3c1e44c7b5402d0fbb2d476d86fc22b |