Django use Email as Username
A Django app to use email as username for user authentication.
- Custom User model with no username field
- Use email as username
- Includes a django-admin command for quick install
- Follow Django best practices for new Django projects and User models.
Install Django use Email as Username:
$ pip install django-use-email-as-username
Add it to your INSTALLED_APPS:
INSTALLED_APPS = ( ... 'django_use_email_as_username.apps.DjangoUseEmailAsUsernameConfig', ... )
Create you new django app:
$ python manage.py create_custom_user_app
Add the new app to your INSTALLED_APPS:
INSTALLED_APPS = ( ... 'django_use_email_as_username.apps.DjangoUseEmailAsUsernameConfig', 'custom_user.apps.CustomUserConfig', ... )
Now instruct Django to use your new model:
AUTH_USER_MODEL = 'custom_user.User'
Create and run migrations:
$ python manage.py makemigrations $ python manage.py migrate
You now have a new Django app which provides a custom User model.
You can further modify the new User Model any time in the future, just remember to create and run the migrations.
This app gives you a custom User model, which is good practice for new Django projects.
Changing to a custom user model mid-project is not easy.
It is recommended to always create a custom User model at the beginning of every Django project.
Tools used in rendering this package: