Add the user object to Django threadlocals
Project description
Introduction
============
Provides a simple middleware and API to get hold of the currently
logged-in user.
Usage
=====
Simply add fez.djangothreadlocal.middleware.threadlocals.ThreadLocals
to your MIDDLEWARE_CLASSES in settings.py, for example:
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware',
'fez.djangothreadlocal.middleware.threadlocals.ThreadLocals',
)
You should then be able to get hold of the current logged-in
user (or anonymous user) as follows:
from fez.djangothreadlocal.middleware import threadlocals
user = threadlocals.get_current_user()
Changelog
=========
0.3 - Initial release
---------------------
* Initial release
============
Provides a simple middleware and API to get hold of the currently
logged-in user.
Usage
=====
Simply add fez.djangothreadlocal.middleware.threadlocals.ThreadLocals
to your MIDDLEWARE_CLASSES in settings.py, for example:
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware',
'fez.djangothreadlocal.middleware.threadlocals.ThreadLocals',
)
You should then be able to get hold of the current logged-in
user (or anonymous user) as follows:
from fez.djangothreadlocal.middleware import threadlocals
user = threadlocals.get_current_user()
Changelog
=========
0.3 - Initial release
---------------------
* Initial release
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
Close
Hashes for fez.djangothreadlocal-0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78c1cd672633285698ea1b4a1810a1b7be6009fa80f1b07004427ec1d17c3e81 |
|
MD5 | 1b3b2e55154de976970246467d1bb5e0 |
|
BLAKE2b-256 | ab8a8455087a4afa77f7b175aa1e77cae7b8dcf7f71cd2c7b909e98326888877 |