Plain is headed towards 1.0! Subscribe for development updates →

plain.impersonate

See what your users see.

A key feature for providing customer support is to be able to view the site through their account. With impersonate installed, you can impersonate a user by finding them in the Django admin and clicking the "Impersonate" button.

Then with the staff toolbar enabled, you'll get a notice of the impersonation and a button to exit:

Installation

To impersonate users, you need the app, middleware, and URLs:

# settings.py
INSTALLED_PACKAGES = INSTALLED_PACKAGES + [
  "plain.staff.impersonate",
]

MIDDLEWARE = MIDDLEWARE + [
  "plain.staff.impersonate.ImpersonateMiddleware",
]
# urls.py
urlpatterns = [
    # ...
    path("impersonate/", include("plain.staff.impersonate.urls")),
]

Settings

By default, all staff users can impersonate other users.

# settings.py
IMPERSONATE_ALLOWED = lambda user: user.is_staff
 1from plain.urls import path
 2
 3from .views import ImpersonateStartView, ImpersonateStopView
 4
 5default_namespace = "impersonate"
 6
 7urlpatterns = [
 8    path("stop/", ImpersonateStopView, name="stop"),
 9    path("start/<pk>/", ImpersonateStartView, name="start"),
10]