Remember where to return to after redirecting a user?

Issue #17 resolved
Chris Wood created an issue

I'm a little confused as to how post-impersonation redirection is supposed to work.

I would like to be able to follow a URL such as <a href="{% url 'impersonate-start' %}?next={{request.path}}">switch user</a> to impersonate a user and then, upon following impersonate-stop, return to what request.path was before.

The README file (following "IMPERSONATE_REDIRECT_FIELD_NAME") makes it sound like this is possible.

However, having examined the redirection methods in helpers.py, it looks like they only examine the request object rather than the session - so there's no memory of where the impersonator came from.

Is that correct?

I could supply a change to (optionally?) record the value of the redirect field to the session.

Comments (4)

  1. Peter Sanchez repo owner

    You're right. Currently there is no "return where you started" functionality. Feel free to submit a pull request. Please include tests and docs for the new feature.

  2. Log in to comment