django-loginas
An app to add a "Log in as user" button in the Django user admin page.
What it is and what it does
django-loginas is a Django admin extension that injects a "Log in as user" button into the user change form, letting superusers impersonate other users for testing and support purposes without needing their passwords. It works by creating a signed session that remembers the original user, allowing automatic restoration when the impersonating user logs out.
The package is configured entirely through Django settings and supports fine-grained access control via a `CAN_LOGIN_AS` callback, custom redirect URLs, optional login reason tracking, and Content Security Policy compatibility. It integrates seamlessly with Django's admin logging system and can track impersonation events. The package supports Python 3 only (3.7 through 3.11 explicitly tested) and Django 2.2 through 6.0.
Use it for:
- Support staff testing user-reported issues by impersonating the affected account in production or staging.
- QA engineers verifying permission-based features work correctly for different user roles without creating test accounts.
- Developers debugging permission or workflow issues during development without needing to know user passwords.
- Admin auditing by logging which staff member impersonated which user and when, via Django's LogEntry system.
- Testing custom User models or permission systems by quickly switching between different user contexts in the admin.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adds a "Log in as user" button to the Django admin interface, allowing superusers to impersonate other users without knowing their passwords.
Yes, if you run a Django project with admin and need user impersonation for testing or support. The package is stable, has no dependencies, and integrates cleanly into existing Django setups. Maintenance is aging (220 days since last release) but the repo is active and supports modern Django versions. Not suitable for production impersonation without careful security review of your `CAN_LOGIN_AS` policy.
Install
django-loginas on PyPI
pip
pip install django-loginasuv
uv add django-loginaspoetry
poetry add django-loginasInstalling django-loginas
Before you install
Low friction: pure Python wheel with no runtime dependencies. Maintenance is aging—last release was 220 days ago—but the repo remains active with recent commits and broad Django version support from 2.2 through 6.0.
License in practice
BSD permissive license places no restrictions on use, modification, or distribution in your own projects.
Quickstart
pip install django-loginas
# settings.py
INSTALLED_APPS = [..., 'loginas', ...]
# urls.py
urlpatterns = [
path('admin/', include('loginas.urls')),
path('admin/', admin.site.urls),
]
# Visit Django admin, navigate to a user, click "Log in as user" button
Requires an existing Django project with admin configured; custom User models need explicit template configuration.
Verify before relying
- Whether the package works with Django versions beyond 6.0 or Python 3.12+, given the aging maintenance status.
- Real-world security implications of impersonation logging and audit trail completeness in production environments.
Package facts
| License | BSD (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | aging — 220 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,244,656/month — #3,192 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_loginas-0.3.14-py2.py3-none-any.whl
Keywords: django
Tags
More Dynamic Content packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
soupsieveSoupsieve is a CSS selector library designed to…
permissive · top 100 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
FlaskFlask is a lightweight WSGI web application…
permissive · top 1,000 on PyPI
MakoMako compiles Python-embedded templates into…
permissive · top 1,000 on PyPI
django-hijackDjango Hijack lets administrators impersonate…
permissive · top 5,000 on PyPI
django-google-ssoAdds Google OAuth 2.0 authentication to Django…
permissive · top 15,000 on PyPI
django-impersonateAllows Django superusers to temporarily assume…
permissive · top 15,000 on PyPI
django-auth-adfsIntegrates Django applications with Microsoft…
permissive · top 15,000 on PyPI
django-maintenance-modeActivates a 503 maintenance page in Django…
permissive · top 15,000 on PyPI
django-object-actionsAdds custom action buttons to Django admin…
permissive · top 5,000 on PyPI
django-admin-extra-buttonsAdds custom buttons, links, and views to Django…
permissive · top 15,000 on PyPI
dj-rest-authProvides drop-in REST API endpoints for user…
permissive · top 5,000 on PyPI
django-defenderBlocks brute-force login attempts in Django by…
permissive · top 15,000 on PyPI
django-authlibProvides passwordless authentication for Django…
permissive · top 15,000 on PyPI