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
File details
Details for the file custom-user-profiles-1.2.0.tar.gz
.
File metadata
- Download URL: custom-user-profiles-1.2.0.tar.gz
- Upload date:
- Size: 1.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac015cfa20d97218fbf5a87995463b1dba8986dff287e343ceee728fe79e6f29 |
|
MD5 | e74237c5e21a61013760256d258a7129 |
|
BLAKE2b-256 | 5d90bb1a80a869c5d80ea59ab1e883b979fd83e10a1c797d603f081c90a2f907 |
File details
Details for the file custom_user_profiles-1.2.0-py2-none-any.whl
.
File metadata
- Download URL: custom_user_profiles-1.2.0-py2-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0047586e066fd821041b115e6a775f9ee1b32348544736b88e6c32c3893eff4 |
|
MD5 | f2b6e211b4b9d5469f04b147081a75c5 |
|
BLAKE2b-256 | b99604e01119604f04aca9d5b2f2eae52d21d6bb0dc93cd1c92fc22c215101ba |