--- id: django-user-sessions version: "2.0.0" license: MIT license_treatment: permissive maintenance: active --- # django-user-sessions — Django sessions with a foreign key to the user License: permissive · Maintenance: active · Downloads: 95.2K/mo ## What it is and what it does Django User Sessions converts Django's built-in session system—which stores all data in opaque base64-encoded blobs—into first-class ORM objects linked to user accounts. This lets you query, filter, and manage sessions like any other Django model. The package stores IP address and user-agent information alongside session data, enabling you to display active sessions to users or administrators and perform bulk operations like logging a user out across all devices. It's a drop-in replacement for Django's standard session backend, requiring only Django as a runtime dependency. The package supports Django 3.2 and 4.0 on Python 3.7, 3.8, 3.9 and 3.10. Common operations include filtering a user's active sessions by expiration date and deleting all sessions for a user in a single call. Use it for: - Display a list of all active sessions for a user in account settings, showing device, IP, and last activity. - Implement a 'log out everywhere' button that terminates all of a user's sessions at once. - Query and audit session data for security monitoring or compliance reporting. - Build admin dashboards that show active user sessions across your application. - Detect and revoke suspicious sessions based on IP address or user-agent anomalies. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Replaces Django's opaque session backend with queryable ORM objects tied to users, letting you list active sessions, log out users globally, and access IP and user-agent data. Yes. This is a mature, actively maintained package (Production/Stable status, 719 GitHub stars) that solves a real Django limitation with zero security vulnerabilities and minimal install friction. Use it if you need per-user session visibility or multi-device logout; skip it if you have no need to query or manage sessions programmatically. ## Install pip install django-user-sessions uv add django-user-sessions poetry add django-user-sessions ## Installing django-user-sessions Before you install: Low friction: single Django dependency, wheel distribution. Actively maintained with recent commits and no known vulnerabilities. License in practice: MIT license is permissive; you can use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions. Quickstart: pip install django-user-sessions # In Django settings, replace django.contrib.sessions with django_user_sessions # Then query sessions: from django.utils.timezone import now user.session_set.filter(expire_date__gt=now()) # Or logout user everywhere: user.session_set.all().delete() Requires Django 3.2 or 4.0; GeoIP setup needed for location detection features. Verify before relying: - Whether GeoIP setup is required for basic session tracking or only for location detection features. - Current compatibility with Django versions beyond 4.0 and Python versions beyond 3.10. ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 95.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags django user sessions queryable, django session management per user, django logout user everywhere, django active sessions list, django session ip user agent, django sessions orm objects, django user session tracking, django-sessions, user-management, authentication [View on SkillFed](https://skillfed.io/packages/django-user-sessions) · [View on PyPI](https://pypi.org/project/django-user-sessions/)