A recent discussion on the django-developers mailing list (
https://groups.google.com/forum/#!msg/django-
developers/gnfX1m5jfm8/lMAucX_oBAAJ ) came to the consensus that adding
them would be a win. It also pointed out existing implementations in
django-extras, documented at https://django-
extras.readthedocs.io/en/latest/ref/http-response.html .
They should be added to Django core.
--
Ticket URL: <https://code.djangoproject.com/ticket/28469>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Unreviewed => Accepted
Old description:
> In the past Django has refused to add more HttpResponse subclasses to
> support all the codes listed in the HTTP RFC, e.g. in #9943
> , HttpResponseNoContent in #3362, etc.
>
> A recent discussion on the django-developers mailing list (
> https://groups.google.com/forum/#!msg/django-
> developers/gnfX1m5jfm8/lMAucX_oBAAJ ) came to the consensus that adding
> them would be a win. It also pointed out existing implementations in
> django-extras, documented at https://django-
> extras.readthedocs.io/en/latest/ref/http-response.html .
>
> They should be added to Django core.
New description:
In the past Django has refused to add more HttpResponse subclasses to
support all the codes listed in the HTTP RFC, e.g. in #9943,
HttpResponseNoContent in #3362, etc.
[https://groups.google.com/forum/#!msg/django-
developers/gnfX1m5jfm8/lMAucX_oBAAJ A recent discussion] on the django-
developers mailing list came to the consensus that adding them would be a
win. It also pointed out [https://django-
extras.readthedocs.io/en/latest/ref/http-response.html existing
implementations in django-extras].
They should be added to Django core.
--
Comment:
As I mentioned on the mailing list, I don't think we should add subclasses
if they don't provide any functionality besides a different status code.
For that, we could document this pattern:
{{{
from http import HTTPStatus
HttpResponse(status=HTTPStatus.NO_CONTENT)
}}}
If a response subclass provides some other additional functionality, I'm
open to adding it.
--
Ticket URL: <https://code.djangoproject.com/ticket/28469#comment:1>
* has_patch: 0 => 1
Comment:
I took a first stab at a documentation patch for this:
https://github.com/django/django/pull/12126
--
Ticket URL: <https://code.djangoproject.com/ticket/28469#comment:2>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"9f1ec9efc35bbb375c9cebb3e0d8c1b7be838338" 9f1ec9e]:
{{{
#!CommitTicketReference repository=""
revision="9f1ec9efc35bbb375c9cebb3e0d8c1b7be838338"
Fixed #28469 -- Doc'd how to create a custom HttpResponse subclass.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28469#comment:3>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"76e0846c90e872a04638a835b7c33b41874441d2" 76e0846c]:
{{{
#!CommitTicketReference repository=""
revision="76e0846c90e872a04638a835b7c33b41874441d2"
[3.0.x] Fixed #28469 -- Doc'd how to create a custom HttpResponse
subclass.
Backport of 9f1ec9efc35bbb375c9cebb3e0d8c1b7be838338 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28469#comment:4>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"ad56858e83c39f50612f635500a1a5df37b245d3" ad56858e]:
{{{
#!CommitTicketReference repository=""
revision="ad56858e83c39f50612f635500a1a5df37b245d3"
[2.2.x] Fixed #28469 -- Doc'd how to create a custom HttpResponse
subclass.
Backport of 9f1ec9efc35bbb375c9cebb3e0d8c1b7be838338 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28469#comment:5>