#19321 closed New feature (fixed)
Add django.contrib.redirects setting for redirect status.
Reported by: | Lebedev Ilya | Owned by: | Lebedev Ilya |
---|---|---|---|
Component: | contrib.redirects | Version: | dev |
Severity: | Normal | Keywords: | redirects, status_code |
Cc: | Lebedev Ilya, unai@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
At the moment django.contrib.redirects redirects only with status 301(Moved Permanently).
It doesn't allow to use django.contrib.redirects if user needs temporary redirect (one of 302/303/307).
This can be solved easily with with adding optional parameter REDIRECT_STATUS_CODE=301/302/303/307.
It will make redirects middleware more flexible and convenient.
Attachments (1)
Change History (8)
comment:1 by , 12 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Uncategorized → New feature |
Version: | 1.4 → master |
by , 12 years ago
Attachment: | 19321.patch added |
---|
comment:2 by , 12 years ago
I attached a patch with the general idea.
It'd be nice to make the implementation, tests (and docs if we decide to document this API) consistent between the redirects and locale middleware (#19277).
comment:3 by , 12 years ago
I've applied the patch and added tests in this pull request.
I didn't add docs because of the comments in #19277. Is this still the case here?
comment:4 by , 11 years ago
Cc: | added |
---|---|
Has patch: | set |
comment:5 by , 11 years ago
Needs documentation: | set |
---|
I think we might as well document these attributes and also include a mention in the release notes.
comment:6 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
The trend is more to add a redirect_class (
HttpResponseRedirectBase
subclass) attribute instead of setting the status code directly (see #19277). But yes, this seems to be a reasonable feature to add.