Django Hijack lets privileged users log in as another user to troubleshoot or support accounts without knowing their password.
Overview
Django Hijack adds user impersonation to Django sites. Administrators who are allowed to hijack can act as another user in the application session, which is useful for customer support and debugging account-specific issues.
Installation adds the hijack app, HijackUserMiddleware, and URL routes under a configurable path. Templates use the hijack library and a can_hijack filter to show hijack controls only when permitted. Hijacking is performed via POST with CSRF protection, passing the target user’s primary key and an optional next redirect.
Version 3.x is a security-oriented rewrite with easier integration, customization, built-in Django admin buttons, and dark-mode styling; it breaks APIs from 2.x. Optional django-hijack.contrib.admin registers admin list integration, and mixins can attach hijack actions to other models linked to users.
Documentation covers stable releases on Read the Docs for both major versions. Testimonials in the project describe support and troubleshooting scenarios where impersonation saves time.
Key features
- Session-based user impersonation
- can_hijack permission filter
- CSRF-protected hijack POST flow
- Custom user model support
- Django admin list integration
- HijackUserAdminMixin for related models
- Configurable redirect after hijack
- Dark-mode capable admin UI (v3)
Use cases
- Support troubleshooting user accounts
- Admin reproduction of user-reported bugs
- Staff actions on behalf of end users