Opened 3 months ago

Closed 5 weeks ago

#35784 closed New feature (fixed)

Add 307 and 308 redirect response codes to django.shortcuts.redirect

Reported by: Lorenzo Peña Owned by: Lorenzo Peña
Component: HTTP handling Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Other than 301 and 302 response codes for redirects, there is also:

Currently, Django is unaware of these.

Proposal:

  • Add two new HTTP response classes for 307 and 308.
  • Enhance django.shortcuts.redirect with a new keyword argument preserve_method that, in combination with the existing permanent, decides which of the four redirect classes to use.

Change History (13)

comment:1 by Lorenzo Peña, 3 months ago

Owner: set to Lorenzo Peña
Status: newassigned

comment:2 by Lorenzo Peña, 3 months ago

Has patch: set

https://github.com/django/django/pull/18616

Proof of concept until the ticket itself is approved. After that tests and documentation will be updated.

comment:3 by Sarah Boyce, 3 months ago

Component: UncategorizedHTTP handling
Summary: Enhance django.shortcuts.redirect with two new types of redirect response codesAdd 307 and 308 redirect response codes to django.shortcuts.redirect
Triage Stage: UnreviewedAccepted
Type: UncategorizedNew feature

Refs #30582 and the old django developer discussion
Agree that the way forward is to add new classes

comment:4 by ontowhee, 3 months ago

Patch needs improvement: set

comment:5 by Lorenzo Peña, 3 months ago

Patch needs improvement: unset

comment:6 by Natalia Bidart, 3 months ago

Needs documentation: set
Needs tests: set
Patch needs improvement: set

comment:7 by Lorenzo Peña, 3 months ago

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

comment:8 by Sarah Boyce, 2 months ago

Patch needs improvement: set

comment:9 by Lorenzo Peña, 7 weeks ago

Patch needs improvement: unset

comment:10 by Sarah Boyce, 6 weeks ago

Triage Stage: AcceptedReady for checkin

comment:11 by Sarah Boyce, 6 weeks ago

Triage Stage: Ready for checkinAccepted

comment:12 by Natalia Bidart, 5 weeks ago

Triage Stage: AcceptedReady for checkin

comment:13 by GitHub <noreply@…>, 5 weeks ago

Resolution: fixed
Status: assignedclosed

In 91c879e:

Fixed #35784 -- Added support for preserving the HTTP request method in HttpResponseRedirectBase.

Co-authored-by: Natalia <124304+nessita@…>

Note: See TracTickets for help on using tickets.
Back to Top