[Answer]-Properly use 'next' paramater in URL, Django

1👍

Inside your login view, just do this:

def login(request):
    """
    Check for login and store the result in login_successful
    """
    path = request.GET.get("next")
    if login_successful:
        if path:
            return HttpResponseRedirect(path)
        else:
            return HttpResponseRedirect(your_earlier_path)

Leave a comment