This release is a pre-release and may not be stable for production use.
Django User Sessions
Django includes excellent built-in sessions, however all the data is hidden away into base64 encoded data. This makes it very difficult to run a query on all active sessions for a particular user. django-user-sessions fixes this and makes session objects a first class citizen like other ORM objects.
Also, have a look at the online example app, hosted by Heroku. It also contains the package django-two-factor-auth, but that application is not a dependency for this package. Also have a look at the bundled example templates and views to see how you can integrate the application into your project.
Compatible with Django 1.4, 1.5, 1.6 and 1.7 on Python 2.6, 2.7, 3.2, 3.3 and 3.4. Documentation is available at readthedocs.org.
Features
To get the list of a user’s sessions:
user.session_set.filter(expire_date__gt=now())
Or logout the user everywhere:
user.session_set.all().delete()
The user’s IP address and user agent are also stored on the session. This allows to show a list of active sessions to the user in the admin:
And also in a custom layout:
Installation
pip install django-user-sessions
In INSTALLED_APPS replace 'django.contrib.sessions' with 'user_sessions'.
In MIDDLEWARE_CLASSES replace 'django.contrib.sessions.middleware.SessionMiddleware' with 'user_sessions.middleware.SessionMiddleware'.
Add SESSION_ENGINE = 'user_sessions.backends.db'.
Add url(r'', include('user_sessions.urls', 'user_sessions')), to your urls.py.
Run python manage.py syncdb (or migrate) and browse to /account/sessions/.
GeoIP
You need to setup GeoIP for the location detection to work. See the Django documentation on installing GeoIP.
Contribute
Fork the repository on GitHub and start hacking.
Run the tests.
Send a pull request with your changes.
Provide a translation using Transifex.
License
This project is licensed under the MIT license.
Metadata
Release files for django-user-sessions 1.0.0-beta1
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-sessions-1.0.0-beta1.tar.gz | 16.9 kB | Without provenance | Details for django-user-sessions-1.0.0-beta1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_user_sessions-1.0.0_beta1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for django_user_sessions-1.0.0_beta1-py2.py3-none-any.whl |
Total release size: 49.9 kB
Release files / django-user-sessions-1.0.0-beta1.tar.gz
| Download URL | django-user-sessions-1.0.0-beta1.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c8a085b6a045c0a3f30d48f7499835ed68ca949459a0df31de59ca29dba7ed7
|
|
BLAKE2b-256 checksum How to use checksums |
29c7aef8f99b46c338b94c5dcfad31408ce74ce697c55963bf8d0a15c82eeecc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_user_sessions-1.0.0_beta1-py2.py3-none-any.whl
| Download URL | django_user_sessions-1.0.0_beta1-py2.py3-none-any.whl |
|---|---|
| Size | 33.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7229ca3b8e73bf9abed416cb0a9d5d247447422ec19816fe8c6ad289b9b6297e
|
|
BLAKE2b-256 checksum How to use checksums |
5ada65f2e5fb10c94c2579f56bf1d6ca8e4f05ce31583875edcff7fbf86dbff2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-user-sessions 1.0.0-beta1
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.