A Django middleware which allows you to view the site on behalf of a user.
Project description
A simple middleware which allows a superuser to view the site on behalf of another user.
This idea originated within Disqus, and has served quite well in helping debug user problems.
Install
Install the package:
pip install django-view-as
Add the middleware:
MIDDLEWARE_CLASSES = ( 'viewas.middleware.ViewAsMiddleware', )
Register the application within INSTALLED_APPS:
INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.sessions', 'viewas', )
Make sure the application loader is available for templates:
TEMPLATE_LOADERS = ( 'django.template.loaders.app_directories.Loader', )
Usage
Load any page with an html response type and you’ll see a new toolbar at the top of the page. Enter a username to change who you’re viewing the site as.
If you need more complex behavior (such as not binding based on the superuser attribute), check out the source the middleware is designed to be extensibile.
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-view-as-0.3.1.tar.gz
.
File metadata
- Download URL: django-view-as-0.3.1.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fadb25e4dc704368e0940d1a4021bca67d248022526d4cd05fb65f54f3ffe3b |
|
MD5 | 6d37d52ad660d5e617c42b3f9b422b9a |
|
BLAKE2b-256 | 82b0aefc93fb7f851e34a74bb335790e21456f53b95ce93418d1f09aa2466c24 |