Opened 7 years ago
Closed 7 years ago
#28547 closed Cleanup/optimization (worksforme)
Documentation unclear if 'redirect' shortcut encodes the url or expects it to be encoded
Reported by: | Jesse | Owned by: | Jake Barber |
---|---|---|---|
Component: | Documentation | Version: | 1.11 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
Would be helpful to include a note under the docs for redirect to say that it will automatically encode the URL for you.
Change History (5)
comment:1 by , 7 years ago
Summary: | Documentation unclear if 'redirect' shortcut encodes the url itself or expects it to be encoded → Documentation unclear if 'redirect' shortcut encodes the url or expects it to be encoded |
---|
comment:2 by , 7 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 7 years ago
Has patch: | set |
---|
comment:4 by , 7 years ago
Type: | Uncategorized → Cleanup/optimization |
---|
comment:5 by , 7 years ago
Resolution: | → worksforme |
---|---|
Status: | assigned → closed |
As discussed in the PR, I don't see a need for clarification here. Django will automatically do the appropriate encoding as needed when it generates a URL. The confusion that lead to this ticket was the case, "An absolute or relative URL, which will be used as-is for the redirect location." The documentation is indeed correct (Django doesn't add encoding for those URLs). The confusion was about browsers adding encoding to URLs, however, this topic seems out of scope for Django's documentation as there's nothing specific about the redirect()
view that would merit a special mention of the behavior.
PR https://github.com/django/django/pull/9060