skillfed

django-loginas

An app to add a "Log in as user" button in the Django user admin page.

django-loginas v0.3.14 2.2M downloads/30d#3,192 on PyPI376
Permissive license BSD AGING released

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-loginas

uv

uv add django-loginas

poetry

poetry add django-loginas

Installing 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

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 2.2Framework :: Django :: 3.2Framework :: Django :: 4.0Framework :: Django :: 4.1Framework :: Django :: 4.2Framework :: Django :: 5.0Framework :: Django :: 5.1Framework :: Django :: 5.2Framework :: Django :: 6.0Intended Audience :: DevelopersNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

django admin user impersonationlogin as another user djangodjango staff impersonationdjango admin testing tooldjango user switchingdjango session hijacking admindjango development user testing
django-adminuser-impersonationtesting-tool

More Dynamic Content packages

MarkupSafe

MarkupSafe provides a text object that escapes…

permissive · top 100 on PyPI

Jinja2

Jinja2 is a templating engine that renders…

permissive · top 100 on PyPI

soupsieve

Soupsieve is a CSS selector library designed to…

permissive · top 100 on PyPI

Werkzeug

Werkzeug is a WSGI utility library providing…

permissive · top 1,000 on PyPI

Flask

Flask is a lightweight WSGI web application…

permissive · top 1,000 on PyPI

Mako

Mako compiles Python-embedded templates into…

permissive · top 1,000 on PyPI

django-hijack

Django Hijack lets administrators impersonate…

permissive · top 5,000 on PyPI

django-google-sso

Adds Google OAuth 2.0 authentication to Django…

permissive · top 15,000 on PyPI

django-impersonate

Allows Django superusers to temporarily assume…

permissive · top 15,000 on PyPI

django-auth-adfs

Integrates Django applications with Microsoft…

permissive · top 15,000 on PyPI

django-maintenance-mode

Activates a 503 maintenance page in Django…

permissive · top 15,000 on PyPI

django-object-actions

Adds custom action buttons to Django admin…

permissive · top 5,000 on PyPI

django-admin-extra-buttons

Adds custom buttons, links, and views to Django…

permissive · top 15,000 on PyPI

dj-rest-auth

Provides drop-in REST API endpoints for user…

permissive · top 5,000 on PyPI

django-defender

Blocks brute-force login attempts in Django by…

permissive · top 15,000 on PyPI

django-authlib

Provides passwordless authentication for Django…

permissive · top 15,000 on PyPI