Bin Chen
Bin Chen

Reputation: 63299

django HttpResponseRedirect will add '/' to the end of url

I am using django HttpResponseRedirect(url) to redirect the user to a new url, but I found this function will add a '/' to the end of url, which breaks my current design.

eg) some of urls is something like: /life/?ret=12344

If a '/' is appended, the url will be /life/?ret=12344/ which makes my prior code confused.

How to avoid adding '/' to the end?

Upvotes: 2

Views: 241

Answers (1)

Alexey Savanovich
Alexey Savanovich

Reputation: 1903

Be aware that Django has APPEND_SLASH option, So APPEND_SLASH = False should be helpful. But in case /life/?ret=12344/ as mentioned @DrTyrsa django should be smart enough

Upvotes: 1

Related Questions