~petersanchez/django-impersonate#59: 
Fall back REDIRECT_URL to "current page" when stopping impersonation

Hi there Peter,

It's a bit irritating when I'm redirected to the home page (or some other specific page) upon stopping impersonation. I'd rather see impersonate to fall back to "display the current page" again, without impersonation (i.e. that may typically result in an Error 404, which is fine).

Kind regards Peter

Status
REPORTED
Submitter
Peter Bittner
Assigned to
No-one
Submitted
3 years ago
Updated
3 years ago
Labels
No labels applied.

~petersanchez 3 years ago

Have you seen the setting USE_HTTP_REFERER? Maybe that will be enough to handle your request?

Peter Bittner 3 years ago · edit

Oh! Interesting feature!

That might be the shorter alternative to the solution we currently have (as we have django-impersonate integrated in the Admin's user model):

IMPERSONATE = {
    'REDIRECT_URL': reverse_lazy('admin:auth_user_changelist'),
}

However, what I'm really after is to show the currently active page at the very moment you press the "Stop impersonate" link or button (NOT when you press "Start impersonate").

My use case is, I want to switch back to "normal" to see how I would see the content I'm currently viewing with the impersonated user's eyes.

Kind regards Peter

Am Mi., 9. Dez. 2020 um 17:44 Uhr schrieb ~petersanchez no-reply@code.netlandish.com:

Have you seen the setting USE_HTTP_REFERER? Maybe that will be enough to handle your request?

-- View on the web: https://todo.code.netlandish.com/~petersanchez/django-impersonate/59#event-740

~petersanchez 3 years ago

I understand. It's an interesting idea. I'll see about finding some time to try this. Of course, patches are happily accepted :)

Register here or Log in to comment, or comment via email.