Skip to main content

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

# 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'

Download files

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

Source Distribution

django-minimal-abstract-user-0.0.2.tar.gz (1.8 kB view details)

Uploaded Source

File details

Details for the file django-minimal-abstract-user-0.0.2.tar.gz.

File metadata

File hashes

Hashes for django-minimal-abstract-user-0.0.2.tar.gz
Algorithm Hash digest
SHA256 ababedd7e3111259d41b80825aac503d3570aa4aed86fef50f1a3da7919ea4bc
MD5 3acfae724d731cb37209ce82d14b4351
BLAKE2b-256 cd9f076dd781d4a97a55bd43e2c5f23d06ace63a598b782d83eb4dce7b36c908

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 file

0.0.1

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page