Skip to main content

Modular user model for Django

PyPI version

django-modular-user lets you easily customize Django's User model, without any compromises. Unlike Django's own AbstractBaseUser, here nothing is irremovable, you can use exactly the parts you want.

Requirements

  • Django 2.0+

Installation

pip install django-modular-user
  • Create a new Django package with following models.py, and a migrations/ subdirectory:
from django_modular_user.user import AbstractUser

class User(AbstractUser):
    pass
  • In settings.py, set AUTH_USER_MODEL = 'your_new_package_name.User'
  • Run ./manage.py makemigrations

Configuration

You may configure the basic profile data with USER_CORE_MODULES setting. For example, to create an User model without usernames and passwords, that uses email as the username, you may use:

USER_CORE_MODULES = [
    'django_modular_user.user:AbstractBaseUser',
    'django_modular_user.user:EmailMixin', # email
    'django_modular_user.user:NamePartsMixin', # given_name, middle_name, family_name
    'django_modular_user.user:ActiveMixin', # is_active
    'django_modular_user.user:StaffMixin', # is_staff
    'django_modular_user.user:PermissionsMixin', # is_superuser and other permissions
    'django_modular_user.user:JoinedMixin', # date_joined
]
USERNAME_FIELD = 'email'
USER_EMAIL_UNIQUE = True

App-specific User mixins

django-modular-user automatically scans all INSTALLED_APPS for user.py modules that contain a UserMixin class. Such mixins are automatically added to the User model; you only need to run ./manage.py makemigrations after adding an app to your INSTALLED_APPS list.

Metadata

Release files for django-modular-user 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-modular-user 0.2.1
File Size Uploaded Provenance Actions
django-modular-user-0.2.1.tar.gz 11.4 kB Without provenance Details for django-modular-user-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-modular-user 0.2.1
File Interpreter ABI Platform Actions
django_modular_user-0.2.1-py3-none-any.whl Python 3 none any Details for django_modular_user-0.2.1-py3-none-any.whl

Total release size: 28.3 kB

Release files / django-modular-user-0.2.1.tar.gz

Download URL django-modular-user-0.2.1.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2df4fc0c193f16d92ba8cbdf914a5a6acbf592ba37fb764a2f2d276726c55372
BLAKE2b-256 checksum
How to use checksums
3880a3f2d42a0c2cc5c9b94cafc4db85771d4ecbd43226b4ae721273faed6130
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.4

Release files / django_modular_user-0.2.1-py3-none-any.whl

Download URL django_modular_user-0.2.1-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e43a3a5c5d73494d36362c30341b02ddf28d1e2118b63123195e39666d3e4c1
BLAKE2b-256 checksum
How to use checksums
9bfdd34ccdaaed4de64f032e93f55e9ce7c0123083b949064c57cde13a3877a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.4

Security for django-modular-user 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page