Login as any user from the Django admin interface, then switch back when done
Project description
Installation
Step 1: Settings
Add django_su to INSTALLED_APPS. Make sure you put it before django.contrib.admin.
Next add the django-su authentication backend:
AUTHENTICATION_BACKENDS = ( # Standard Django auth "django.contrib.auth.backends.ModelBackend", # django-su auth "django_su.backends.SuBackend", )
Step 2: urls.py
Add this to your root urls.py file:
url(r"^su/", include("django_su.urls")),
And that should be it!
Step 3: Install other eggs (optional, but recommended)
If you install these two eggs the enhance user experience:
The ‘login su’ form will render using django admin forms
The user selection widget will render using django ajax selects
Note that django ajax selects requires the following settings:
AJAX_LOOKUP_CHANNELS = {'django_su': dict(model='auth.user', search_field='username')}
Step 4: Customize django_su (optional)
In your settings you can configure:
SU_REDIRECT_LOGIN: URL to redirect after the login. By default is “/”
SU_REDIRECT_EXIT: URL to redirect after the logout. By default is “/”
SU_LOGIN: A function to specify the perms that the user must have can use django_su
SU_CUSTOM_LOGIN_ACTION: A function to override the django.contrib.auth.login(request, user) function so you can set session data, etc.
Usage
Go and view a user in the admin interface and look for a new ‘Login as’ button in the top right.
Once you have su’ed into a user, you can get exit back into your original user by navigating to /su/ in your browser.
Credits
This app was put together by Adam Charnock, but was largely based on ideas, code and comments at:
django-su is packaged using seed.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-su-0.4.6.tar.gz
.
File metadata
- Download URL: django-su-0.4.6.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24cd0092b4084921e16db1b7921b3c16cccb3056896c9bdc1a809580e31e1650 |
|
MD5 | b5e3e3526c8939c426c1d6c609fe7a37 |
|
BLAKE2b-256 | ef670e0f311c2da24239be9d4edcc9f831766fba0a2b996a9a31b54729e90807 |