I have a function based view that I only use to update a session:
def admin_privileges(request):
// toggle request.session['is_admin']
return
Typically I use this to toggle a session variable between True
and False
.
E.g. in a template:
<a href="{% url 'admin_privileges' %}">Toggle admin privileges</a>
How can I pass a variable and amend return
in admin_privileges
to return the user to the original view it was requested from?
I don't want to use anything on the front end, and I can't use HTTP_REFERRER
as it's not always set.
I thought of passing something via the URL from the referring view?