Pass through remaining query arguments.
- Legacy-Id: 342
This commit is contained in:
parent
890b8a1ada
commit
0d2bbe54e9
|
@ -33,4 +33,11 @@ def redirect(request, path="", script=""):
|
|||
url = re.sub(r'/+', '/', url)
|
||||
if remove:
|
||||
url = re.sub(re.escape(remove) + "/?$", "", url)
|
||||
# Copy the GET arguments, remove all the ones we were
|
||||
# expecting and if there are any left, add them to the URL.
|
||||
get = request.GET.copy()
|
||||
for arg in re.findall(r'%\(([^)]+)\)', rest):
|
||||
get.pop(arg)
|
||||
if get:
|
||||
url += '?' + get.urlencode()
|
||||
return HttpResponseRedirect(url)
|
||||
|
|
Loading…
Reference in a new issue