Django-User-Extension
Description
This is a simple app that that helps you subclass the Django User model. It makes use of the InheritanceQuerySet provided by Django-Model-Utils to make it possible for you to create as many subclasses of the User model as you like.
It’s usually recommended to create a “user profile” model when you want to store additional information about each user. Unfortunately, this doesn’t work at all if you need multiple user models with different information in each. It’s also a bit of a pain to make sure a profile exists and get_profile() can sometimes introduce extra database queries.
Requirements and Installation
Django-User-Extension requires:
Django
Django-Model-Utils
setuptools or preferably distribute
Installation is as simple as:
pip install django-user-extension
Source
You can install the latest development version from the hg repository with:
pip install -e hg+http://code.db-init.com/django-user-extension
Or from a tarball with:
pip install django-user-extension==dev
Usage
Django-User-Extension provides a modified authentication ModelBackend class that resolves the correct User subclass. This will ensure that request.user represents your subclass model. Simply add this to your settings.py:
AUTHENTICATION_BACKENDS = ('user_extension.backends.SubUserModelBackend',)
Also provided is a modified admin UserAdmin class that will allow you to easily add your subclasses to the Django admin. If you try to use the default UserAdmin you’ll get an error message when add any of your custom fields to fieldsets. Make sure you also add any required fields to add_fieldsets. You can use it like this in your admin.py:
from user_extension.admin import SubUserAdmin
class CustomUserAdmin(SubUserAdmin):
fieldsets = SubUserAdmin.fieldsets[:2] + (
(None, {
'fields': ('picture',)
}),
) + SubUserAdmin.fieldsets[2:]
add_fieldsets = SubUserAdmin.add_fieldsets + (
(None, {
'fields': ('picture',)
}),
)
Metadata
Release files for django-user-extension 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-user-extension-1.0.0.tar.gz | 3.1 kB | Without provenance | Details for django-user-extension-1.0.0.tar.gz |
Release files / django-user-extension-1.0.0.tar.gz
| Download URL | django-user-extension-1.0.0.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d24f43ac03db6f798c85e36b2b9218f5d0b21d9b4ccb44ab734a163671bbec2f
|
|
BLAKE2b-256 checksum How to use checksums |
ea3840d314288ef67ad2de6e047680343c58c2309291f99fb5c68530d1e0ad29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-user-extension 1.0.0
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.