Skip to main content

django-user-mixins

Build Status

User model mixins based on Django.

user_mixins model mixins give flexibility to create your own User model. By default all mixins are optional. Our mixins allow to create, identify users (from their emails instead of their username) as well as sending password reset and account validation emails.

Installation

Install the package:

pip install django-user-mixins

Install with avatar functionality:

pip install django-user-mixins[avatar]

User model

To create a custom user model using the django-user-mixins functionality, declare your user class like this:

from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
from user_mixins.mixins import ActiveUserMixin


class User(ActiveUserMixin, PermissionsMixin, AbstractBaseUser):
    pass

If you want to use the VerifyEmailMixin, substitute it for ActiveUserMixin.

Make sure the app containing your custom user model is added to settings.INSTALLED_APPS, and set settings.AUTH_USER_MODEL to be the path to your custom user model.

If you use EmailUserMixin or any of its derivatives, you'll need to set up Postgres to support a CIText extension in your migration. Add the following to your migration:

from django.contrib.postgres.operations import CITextExtension

operations = [
    CITextExtension(),
    ...
]

Mixins

ActiveUserMixin

user_mixins.mixins.ActiveUserMixin provides a base custom user mixin with a name, email, date_joined, is_staff, and is_active.

VerifyEmailMixin

user_mixins.mixins.VerifyEmailMixin extends ActiveUserMixin to provide functionality to verify the email. It includes an additional email_verified field.

By default, users will be created with is_active = False. A verification email will be sent including a link to verify the email and activate the account.

AvatarMixin

user_mixins.mixins.AvatarMixin adds an avatar field. The serializers for this field require django-imagekit to be installed.

Metadata

Release files for django-user-mixins 0.0.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-user-mixins 0.0.1
File Size Uploaded
django-user-mixins-0.0.1.tar.gz 12.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-user-mixins 0.0.1
File Interpreter ABI Platform
django_user_mixins-0.0.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 31.5 kB

Release files / django-user-mixins-0.0.1.tar.gz

Download URL django-user-mixins-0.0.1.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c8cab792a1e7c4be7fe218e5c2873d4d6162f61dd4f39a120b4e003541cb504f
BLAKE2b-256 checksum
How to use checksums
d169276b0e34aa07eb6a24431bfb68ed32afc77d38e3847bb9c0140be0c3ffb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.8

Release files / django_user_mixins-0.0.1-py2.py3-none-any.whl

Download URL django_user_mixins-0.0.1-py2.py3-none-any.whl
Size 18.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c594d9b7e3d3d7e38c9ba3e81fadf7070bfef5f188858a0a7276192eff7f84b5
BLAKE2b-256 checksum
How to use checksums
d750a8d76d4d1b20e421c8bf1f5e86ca9e99f8907d6d2d7918af0353f2dd8380
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

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