Django admin site integration for Django Hijack
Clone or download
arteria GmbH
Latest commit 934b2b9 Aug 7, 2018
Permalink
Failed to load latest commit information.
docs Docs Apr 12, 2016
hijack_admin Bump version: 2.1.9 → 2.1.10 Aug 7, 2018
.bumpversion.cfg Bump version: 2.1.9 → 2.1.10 Aug 7, 2018
.coveragerc Copy admin-related code from https://github.com/arteria/django-hijack;… Apr 12, 2016
.gitignore Add Russian language translate Dec 19, 2017
.travis.yml use tox to run tests Dec 5, 2017
AUTHORS Added @lukasgarcya to the list of authors. Aug 7, 2018
CHANGELOG.txt Update CHANGELOG.txt Dec 22, 2017
CONTRIBUTING.md added guidelines for contributing Feb 21, 2018
DESCRIPTION Copy admin-related code from https://github.com/arteria/django-hijack;… Apr 12, 2016
LICENSE Copy admin-related code from https://github.com/arteria/django-hijack;… Apr 12, 2016
MANIFEST.in Add compiled messages to package (arteria/django-hijack#131) Feb 22, 2017
Makefile Copy admin-related code from https://github.com/arteria/django-hijack;… Apr 12, 2016
README.md Updated docs, HIJACK_USER_ADMIN_CLASS_NAME May 26, 2018
manage.py Copy admin-related code from https://github.com/arteria/django-hijack;… Apr 12, 2016
requirements-test.txt Copy admin-related code from https://github.com/arteria/django-hijack;… Apr 12, 2016
requirements.txt use current version for django-hijack Dec 5, 2017
runtests.py Copy admin-related code from https://github.com/arteria/django-hijack;… Apr 12, 2016
setup.cfg Copy admin-related code from https://github.com/arteria/django-hijack;… Apr 12, 2016
setup.py Django 1.10 compatibility Aug 8, 2016
tox.ini use tox to run tests Dec 5, 2017
upload.sh Copy admin-related code from https://github.com/arteria/django-hijack;… Apr 12, 2016

README.md

django-hijack-admin

Django admin integration for Django Hijack (https://github.com/arteria/django-hijack/)

Build Status Coverage Status PyPI

Screenshot of django-hijack in action on the admin site.

Installation

Follow the instructions on http://django-hijack.readthedocs.org/en/stable/#installation to install django-hijack.

Get the latest stable release from PyPi:

pip install django-hijack-admin

In your settings.py, add hijack_admin to your installed apps:

INSTALLED_APPS = (
    ...,
    'hijack_admin',
)

For the admin integration to work, you must explicitly set HIJACK_ALLOW_GET_REQUESTS = True in your project settings. Please be aware that users can now be hijacked not only using POST requests, but also using GET requests, which could facilitate CSRF attacks.

Configuration

HIJACK_BUTTON_TEMPLATE

Path to the template for the "Hijack" buttons. Default: 'hijack_admin/admin_button.html'

HIJACK_REGISTER_ADMIN

Whether the user model should be registered with HijackUserAdmin automatically. Default: True

HIJACK_USER_ADMIN_CLASS_NAME

Adds the possibility to configure the admin class name.

Custom user admins

Custom user admins are supported. Just set HIJACK_REGISTER_ADMIN = False and modify your custom admin class as shown in this example:

# admin.py
from hijack_admin.admin import HijackUserAdminMixin

class MyUserAdmin(UserAdmin, HijackUserAdminMixin):
    list_display = (
        ...
        'hijack_field',  # Hijack button
    )

Models with ForeignKey to User

You can also add the hijack field to a model that is related to the User model with the HijackRelatedAdminMixin.

#admin.py
from django.contrib import Admin
from hijack_admin.admin import HijackRelatedAdminMixin

class MyCustomerAdmin(HijackRelatedAdminMixin, admin.ModelAdmin)
    list_display = ('user', 'hijack_field')

Contributing

Anyone and everyone is welcome to contribute. Please take a moment to review the guidelines for contributing.

django-hijack-admin is free software. If you find it useful and would like to give back, please consider to make a donation using Bitcoin or PayPal. Thank you!