Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ilyasemenov/django-minimal-abstract-user
Django AbstractUser without username, first_name, last_name, email but with is_staff and PermissionsMixin
https://github.com/ilyasemenov/django-minimal-abstract-user
Last synced: 11 days ago
JSON representation
Django AbstractUser without username, first_name, last_name, email but with is_staff and PermissionsMixin
- Host: GitHub
- URL: https://github.com/ilyasemenov/django-minimal-abstract-user
- Owner: IlyaSemenov
- Created: 2016-07-14T12:07:43.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-07-14T12:07:54.000Z (over 8 years ago)
- Last Synced: 2024-09-20T04:15:02.299Z (about 2 months ago)
- Language: Python
- Size: 1000 Bytes
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
django-minimal-abstract-user
============================By default, Django custom ``User`` model suffers from the following:
* If you derive from ``django.contrib.auth.models.base_user.AbstractBaseUser`` you don't get Django Admin integration, permissions and ``manage.py createsuperuser`` (a real deal breaker for simpler projects!)
* If you derive from ``django.contrib.auth.models.AbstractUser`` you get hard-coded ``username``, ``first_name``, ``last_name`` and ``email`` (what if you don't need to separate first and last name, and don't need usernames at all?)This library provides a better ``AbstractUser`` class which works around both problems and provides a minimal abstract base ``User`` model that doesn't have any extra fields but supports permissions and Django Admin.
Installation
============::
pip install django_minimal_abstract_user
Usage
=====.. code:: python
# yourproject/accounts/models.py
from django_minimal_abstract_user import AbstractUser
class User(AbstractUser):
full_name = models.CharField(max_length=60)
email = models.EmailField(_('email address'), unique=True)
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = ['full_name'] # Optional# yourproject/settings.py
AUTH_USER_MODEL = 'accounts.User'