Custom User Model
Project description
Eazy Django User
Eazy Django User is a django package that provides a user model with user email as the identifier.
Installation
Use the package manager pip to install foobar.
pip install eazy-django-user
Usage
- Add "eazy_user" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [
...
'eazy_user',
]
- set AUTH_USER_MODEL in setting.py to "eazy_user.EmailUser" like this: Note: Add this setting before initial migration else there will be clashes with the default user model.
AUTH_USER_MODEL = 'eazy_user.EmailUser'
- Run
python manage.py migrateto apply the migrations to the database.
python manage.py migrate
- You can access the user foreign key like this:
from django.conf import settings
User = settings.AUTH_USER_MODEL
class YourModel(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
- Or by using the get_user_model method.
from django.contrib.auth import get_user_model
User = get_user_model()
But you would most likely want to extend the python EmailUser model you can do that easily:
from eazy_user.models import EmailUser
class YourCustomUser(EmailUser):
....
Whatever you choose, make sure to set the resulting user model as the python AUTH_USER_MODEL in the settings.py file
AUTH_USER_MODEL = '<your_app_name>.<YourCustomUser>' """<your_app_name> refers to the app that contains your custom user model, while <YourCustomUser> is the custom user model."""
Now you can proceed to creating a super user bash python manage.py createsuperuser like you normaly would, and enjoy :)
License
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file eazy-django-user-1.1.1.tar.gz.
File metadata
- Download URL: eazy-django-user-1.1.1.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
580354d7cea43476ff20cda1c0476759f0010342e7ef0a493487bf6091966c12
|
|
| MD5 |
9f03c1a8f7a7d4d151c0d6a1806b3bcc
|
|
| BLAKE2b-256 |
8e12194725a39171b81386847a3b1963fec30b07539188667407e73b4af42940
|
File details
Details for the file eazy_django_user-1.1.1-py3-none-any.whl.
File metadata
- Download URL: eazy_django_user-1.1.1-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b295dbdb12de42961a0e0fccbd3e5b3b118dd3838d78b60a4a0e8621c755c2b3
|
|
| MD5 |
70cf3083b857d43553b665a745c8e319
|
|
| BLAKE2b-256 |
a3deafc54c420a551b526b59d0944fa184f88b9827b7248bb34db48c407aec11
|