Create custom-user profiles easily
Project description
Quick start
Add to INSTALLED_APPS setting
INSTALLED_APPS = ( # ... 'custom_user', 'custom_user_profiles )
Set AUTH_USER_MODEL setting
AUTH_USER_MODEL = 'custom_user_profiles.CustomUser'
the CustomUser inherit from AbstractEmailUser model from [django-custom-user](https://github.com/jcugat/django-custom-user)
If you want to create your own custom user, extend custom_user_profiles.models.AbstractCustomUser.
from custom_user_profiles.models import AbstractCustomUser class CustomUser(AbstractCustomUser): # ...
Create your profile models
from custom_user_profiles.models import Profile class Buyer(Profile): # ... class Seller(Profile): # ...
Usage
@login_required def view(request): profile = request.user.profile if request.user.is_seller: # ...
Also AbstractCustomUser provides a chainable QuerySet manager:
from django.contrib.auth import get_user_model User = get_user_model() User.queryset.seller() # get all users with 'seller' profile User.queryset.buyer() # get all users with 'buyer' profile User.queryset.something() # raises django.core.exceptions.FieldError
objects manager is still available and inherit from django’s BaseUserManager
Project details
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
Close
Hashes for custom-user-profiles-1.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 124e9805978f2092e752d354eb035d3af6ef3cf4d1170c0a66dd26a96f7d383e |
|
MD5 | 935dcfdc836e6e55306ec84758005a3b |
|
BLAKE2b-256 | 3d01e373f0936dd2764d40aece573b52849bd9c773ad477c01615bcd2851d0ce |
Close
Hashes for custom_user_profiles-1.1.1-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba21d6dc3e8cbea870fb80f21f1cd5348c53b95d8de093a0fb4c0f559ed0f6e3 |
|
MD5 | 5afef868610203128fe079c6ee8d2c03 |
|
BLAKE2b-256 | ec29fc0f0b512aa56b462532affdcfc81e04ff2173d9b97f7e8edd0bd63b4cb2 |