[Solved]-Django: Redirect to previous page *with query string* after login

11👍

How about escaping the get parameters and then unquoting them in the view?

html

<a href="{% url user_login %}?next={{ request.get_full_path|urlencode }}">Login</a>

login view

if successful_login:
    url_with_get = urllib2.unquote(request.GET.get('next'))
    return http.HttpResponseRedirect(url_with_get)

PS: I’ve stumbled across your blog many times looking for PIP help : )

Leave a comment