<commit_before># django-hijack-admin

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

[![Build Status](https://travis-ci.org/arteria/django-hijack-admin.svg?branch=master)](https://travis-ci.org/arteria/django-hijack-admin)
[![Coverage Status](https://coveralls.io/repos/arteria/django-hijack-admin/badge.svg?branch=master&service=github)](https://coveralls.io/github/arteria/django-hijack-admin?branch=master)
[![PyPI](https://img.shields.io/pypi/v/django-hijack-admin.svg)](https://pypi.python.org/pypi/django-hijack-admin)

![Screenshot of django-hijack in action on the admin site.](docs/admin-screenshot.png)


## 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:

```python
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`

## 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:

```python
# admin.py
from hijack_admin.admin import HijackUserAdminMixin

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

## Models with ForeignKey to User<commit_msg>Updated docs, HIJACK_USER_ADMIN_CLASS_NAME<commit_after># django-hijack-admin

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

[![Build Status](https://travis-ci.org/arteria/django-hijack-admin.svg?branch=master)](https://travis-ci.org/arteria/django-hijack-admin)
[![Coverage Status](https://coveralls.io/repos/arteria/django-hijack-admin/badge.svg?branch=master&service=github)](https://coveralls.io/github/arteria/django-hijack-admin?branch=master)
[![PyPI](https://img.shields.io/pypi/v/django-hijack-admin.svg)](https://pypi.python.org/pypi/django-hijack-admin)

![Screenshot of django-hijack in action on the admin site.](docs/admin-screenshot.png)


## 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:

```python
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:

```python
# admin.py
from hijack_admin.admin import HijackUserAdminMixin

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

## Models with ForeignKey to User
{'fraction_non_alphanumeric': 0.1172224987555998, 'fraction_numerical': 0.0, 'mean_word_length': 4.954074074074074, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6376335', 'n_tokens_mistral': 1343, 'n_tokens_neox': 1306, 'n_words': 331}