Skip to main content

Django UserSwitch

A quick ‘n’ dirty django app for switching between different users while testing.

  • “Quick and dirty”. Just include the middleware. That’s it!

  • Provides a select box with a list of users.

  • User list can be defined in settings or all users are loaded.

  • Works only when settings.DEBUG is True

Requirements

Django 1.2

Installation

To install the latest version:

pip install git+git://github.com/ikraftsoft/django-userswitch#egg=django-userswitch

It can also be installed from PyPI with pip or easy_install:

pip install django-userswitch
easy_install install django-userswitch

Setup & Usage

Add userswitch middleware to the MIDDLEWARE_CLASSES in settings.py after the default middlewares:

MIDDLEWARE_CLASSES = (
  'django.middleware.common.CommonMiddleware',
  'django.contrib.sessions.middleware.SessionMiddleware',
  'django.middleware.csrf.CsrfViewMiddleware',
  'django.contrib.auth.middleware.AuthenticationMiddleware',
  'django.contrib.messages.middleware.MessageMiddleware',
  ...
  'userswitch.middleware.UserSwitchMiddleware',
)

Optionally you can add USERSWITCH_OPTIONS dict to the settings.py:

USERSWITCH_OPTIONS = {
    'css_class': '',       # CSS class to be added to the switcher widget. Default='userswitch'.
    'css_inline': '',      # Inline css for the switcher widget, if any
    'content_types': (),   # a tuple of content-type for which to render switcher widget. Default = ('text/html', 'application/xhtml+xml')
    'auth_backend': '',    # Custom auth backend if any. Default = 'django.contrib.auth.backends.ModelBackend'
    'replace_text': '',    # Text to replace with the widget, default add to end "body" tag.
    'users': (),           # List of usernames(as strings) to be shown in the switcher widget. If its empty, all users are loaded.
    'force_on': False,     # Turns on USERSWITCH even if DEBUG = False,
    'onchange_redirect_url': '/'    # The url to redirect the user to onchange of user selection.
}

Note: default value of css_inline option provides some basic absolute positioning. To change those either specify css_inline option manually or override position, top, right in the class specified in css_class with !important.

That’s All!

Metadata

Release files for django-userswitch-fork 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-userswitch-fork 0.2.4
File Size Uploaded Provenance Actions
django-userswitch-fork-0.2.4.tar.gz 3.6 kB Without provenance Details for django-userswitch-fork-0.2.4.tar.gz

Release files / django-userswitch-fork-0.2.4.tar.gz

Download URL django-userswitch-fork-0.2.4.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
efc14c4df2ce2da0aabd6127bb1f9d9d28f43ad8e41c91ad94a9dc774b47f9d3
BLAKE2b-256 checksum
How to use checksums
3fdc703ee033f098b837eddf6ddb40870963c255a313029bf14e756aa0f038f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-userswitch-fork 0.2.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.4 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page