Opened 2 years ago

Closed 23 months 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, 2 years ago

Owner: set to Lorenzo Peña
Status: new → assigned

comment:2 by Lorenzo Peña, 2 years 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, 2 years ago

Component: Uncategorized → HTTP handling
Summary: Enhance django.shortcuts.redirect with two new types of redirect response codes → Add 307 and 308 redirect response codes to django.shortcuts.redirect
Triage Stage: Unreviewed → Accepted
Type: Uncategorized → New feature

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

comment:4 by ontowhee, 2 years ago

Patch needs improvement: set

comment:5 by Lorenzo Peña, 2 years ago

Patch needs improvement: unset

comment:6 by Natalia Bidart, 2 years ago

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

comment:7 by Lorenzo Peña, 2 years ago

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

comment:8 by Sarah Boyce, 2 years ago

Patch needs improvement: set

comment:9 by Lorenzo Peña, 23 months ago

Patch needs improvement: unset

comment:10 by Sarah Boyce, 23 months ago

Triage Stage: Accepted → Ready for checkin

comment:11 by Sarah Boyce, 23 months ago

Triage Stage: Ready for checkin → Accepted

comment:12 by Natalia Bidart, 23 months ago

Triage Stage: Accepted → Ready for checkin

comment:13 by GitHub <noreply@…>, 23 months ago

Resolution: → fixed
Status: assigned → closed

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