Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-view-as-0.2.1.tar.gz (7.6 kB view details)

Uploaded Source

File details

Details for the file django-view-as-0.2.1.tar.gz.

File metadata

File hashes

Hashes for django-view-as-0.2.1.tar.gz
Algorithm Hash digest
SHA256 72e50a5ba5f552922c0cf7640e9d308e48f1c0fa01236f4c345354be38a54f78
MD5 1773a363e169a7c060397e334815100b
BLAKE2b-256 f92cf3ed5649febb95466f84c6f1260af1ad6e6d0cc95dc56230fdb9f5f45332

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page