Conveniently store reference to request user on thread/db level.
Project description
Quickstart
Install django-currentuser:
pip install django-currentuser
Add it to the middleware classes in your settings.py:
MIDDLEWARE_CLASSES = ( ..., 'django_currentuser.middleware.ThreadLocalUserMiddleware', )
Then use it in a project:
from django_currentuser.middleware import ( get_current_user, get_current_authenticated_user) # As model field: from django_currentuser.db.models import CurrentUserField class Foo(models.Model): created_by = CurrentUserField()
Release Notes
0.1.0 - initial release
provides middleware + methods to set + retrieve reference of currenty logged in user from thread
provides CurrentUserField that by default stores the currently logged in user
supports Django 1.8, 1.9, 1.10, 1.11 on python 2.7, 3.3, 3.4, 3.5, and 3.6 - as per the official django docs
Contributing
As an open source project, we welcome contributions.
The code lives on github.
Reporting issues/improvements
Please open an issue on github or provide a pull request whether for code or for the documentation.
For non-trivial changes, we kindly ask you to open an issue, as it might be rejected. However, if the diff of a pull request better illustrates the point, feel free to make it a pull request anyway.
Pull Requests
for code changes
it must have tests covering the change. You might be asked to cover missing scenarios
the latest flake8 will be run and shouldn’t produce any warning
if the change is significant enough, documentation has to be provided
Setting up all Python versions
sudo apt-get -y install software-properties-common sudo add-apt-repository ppa:fkrull/deadsnakes sudo apt-get update for version in 3.3 3.5 3.6; do py=python$version sudo apt-get -y install ${py} ${py}-dev done
Code of Conduct
As it is a Django extension, it follows Django’s own Code of Conduct. As there is no mailing list yet, please just email one of the main authors (see setup.py file or github contributors)
Project details
Release history Release notifications | RSS feed
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
Hashes for django_currentuser-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3477066addcb41db16603d9de338f1199aa21b4ddcb35c02dc084591dce4a45f |
|
MD5 | 196565350cf987997c67db271d6053a6 |
|
BLAKE2b-256 | 4a515199c092bc3c6b2001bc0d42a345f0d19fdcdea3a3c4da2760f61931de77 |