All Projects → jazzband → Django User Sessions

jazzband / Django User Sessions

Licence: mit
Extend Django sessions with a foreign key back to the user, allowing enumerating all user's sessions.

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Django User Sessions

Django Celery Email
A Django email backend that uses a celery task for sending the email.
Stars: ✭ 351 (-4.62%)
Mutual labels:  django
Django Watchman
django-watchman exposes a status endpoint for your backing services like databases, caches, etc.
Stars: ✭ 357 (-2.99%)
Mutual labels:  django
Firefox Profilemaker
Tool to create firefox profiles with good defaults.
Stars: ✭ 361 (-1.9%)
Mutual labels:  django
Channels Api
RESTful Websocket APIs with Django Rest Framework and Channels
Stars: ✭ 353 (-4.08%)
Mutual labels:  django
Graphene Django Extras
Extras functionalities for Graphene-Django
Stars: ✭ 356 (-3.26%)
Mutual labels:  django
Django Bakery
A set of helpers for baking your Django site out as flat files
Stars: ✭ 360 (-2.17%)
Mutual labels:  django
Django Pg Zero Downtime Migrations
Django postgresql backend that apply migrations with respect to database locks
Stars: ✭ 351 (-4.62%)
Mutual labels:  django
Healthchecks
A cron monitoring tool written in Python & Django
Stars: ✭ 4,297 (+1067.66%)
Mutual labels:  django
Awesome Django Admin
Curated List of Awesome Django Admin Panel Articles, Libraries/Packages, Books, Themes, Videos, Resources.
Stars: ✭ 356 (-3.26%)
Mutual labels:  django
Django Tutorial
Django 基本教學 - 從無到有 Django-Beginners-Guide 📝
Stars: ✭ 365 (-0.82%)
Mutual labels:  django
Django Sekizai
Django Template Blocks with extra functionality
Stars: ✭ 353 (-4.08%)
Mutual labels:  django
Collectfast
A faster collectstatic command.
Stars: ✭ 352 (-4.35%)
Mutual labels:  django
Django Fobi
Form generator/builder application for Django done right: customisable, modular, user- and developer- friendly.
Stars: ✭ 360 (-2.17%)
Mutual labels:  django
Typeidea
Django企业开发实战对应项目代码
Stars: ✭ 351 (-4.62%)
Mutual labels:  django
Django Postgres Extra
Bringing all of PostgreSQL's awesomeness to Django.
Stars: ✭ 365 (-0.82%)
Mutual labels:  django
Drf Flex Fields
Dynamically set fields and expand nested resources in Django REST Framework serializers.
Stars: ✭ 350 (-4.89%)
Mutual labels:  django
Try Django 1.11
Learn the fundamentals behind one of the most popular web frameworks in the world: Django. We will teach you step-by-step how to implement concepts like Views, Template Rendering, Forms, Saving Data, URL routing, Deployment aka Going Live, and so much more. Django is a web-framework written in Python and runs the backend for many of the internet's most popular websites such as Instagram and Pinterest. Get started today!
Stars: ✭ 359 (-2.45%)
Mutual labels:  django
Django Api Domains
A pragmatic styleguide for Django API Projects
Stars: ✭ 365 (-0.82%)
Mutual labels:  django
Django Blog
django搭建博客
Stars: ✭ 365 (-0.82%)
Mutual labels:  django
Pretalx
Conference planning tool: CfP, scheduling, speaker management
Stars: ✭ 363 (-1.36%)
Mutual labels:  django

==================== Django User Sessions

.. image:: https://jazzband.co/static/img/badge.svg :target: https://jazzband.co/ :alt: Jazzband

.. image:: https://github.com/jazzband/django-user-sessions/workflows/Test/badge.svg :alt: GitHub Actions :target: https://github.com/jazzband/django-user-sessions/actions

.. image:: https://codecov.io/gh/jazzband/django-user-sessions/branch/master/graph/badge.svg :alt: Test Coverage :target: https://codecov.io/gh/jazzband/django-user-sessions

.. image:: https://badge.fury.io/py/django-user-sessions.svg :alt: PyPI :target: https://pypi.python.org/pypi/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. It is a drop-in replacement for django.contrib.sessions.

I would love to hear your feedback on this package. If you run into problems, please file an issue on GitHub, or contribute to the project by forking the repository and sending some pull requests. The package is translated into English, Dutch and other languages. Please contribute your own language using Transifex_.

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 2.2, 3.0 and 3.1 on Python 3.6, 3.7, 3.8 and 3.9. Documentation is available at readthedocs.org_.

Features

To get the list of a user's sessions:

.. code-block:: python

user.session_set.filter(expire_date__gt=now())

Or logout the user everywhere:

.. code-block:: python

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:

.. image:: http://i.imgur.com/YV9Nx3f.png

And also in a custom layout:

.. image:: http://i.imgur.com/d7kZtr9.png

Installation

Refer to the installation instructions_ in the documentation.

GeoIP

You need to setup GeoIP for the location detection to work. See the Django documentation on installing GeoIP_.

Getting help

For general questions regarding this package, please hop over to Stack Overflow. If you think there is an issue with this package; check if the issue is already listed (either open or closed), and file an issue if it's not.

Development

How to contribute

  • Fork the repository on GitHub and start hacking.
  • Run the tests.
  • Send a pull request with your changes.
  • Provide a translation using Transifex_.

Running tests

This project aims for full code-coverage, this means that your code should be well-tested. Also test branches for hardened code. You can run the full test suite with::

make test

Or run a specific test with::

make test TARGET=tests.tests.MiddlewareTest

For Python compatibility, tox_ is used. You can run the full test suite with::

tox

Releasing

The following actions are required to push a new version:

  • Update release notes

  • If any new translations strings were added, push the new source language to Transifex_. Make sure translators have sufficient time to translate those new strings::

    make tx-push

  • Add migrations::

    python example/manage.py makemigrations user_sessions git commit user_sessions/migrations -m "Added migrations"

  • Update translations::

    make tx-pull

  • Package and upload::

    bumpversion [major|minor|patch] git push && git push --tags python setup.py sdist bdist_wheel twine upload dist/*

License

This project is licensed under the MIT license.

Credits

This library was written by Bouke Haarsma_ and contributors_.

.. _Transifex: https://www.transifex.com/projects/p/django-user-sessions/ .. _readthedocs.org: https://django-user-sessions.readthedocs.org/ .. _installation instructions: https://django-user-sessions.readthedocs.io/en/stable/installation.html .. _example app: https://example-two-factor-auth.herokuapp.com .. _Heroku: https://www.heroku.com .. _django-two-factor-auth: https://github.com/jazzband/django-two-factor-auth .. _installing GeoIP: https://docs.djangoproject.com/en/2.0/ref/contrib/gis/geoip2/ .. _tox: https://testrun.org/tox/latest/ .. _Bouke Haarsma: https://github.com/Bouke .. _contributors: https://github.com/jazzband/django-user-sessions/graphs/contributors

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].