Fixed #33683 -- Document HttpResponseBase and allow import from django.http

This commit is contained in:
Collin Anderson 2022-05-05 15:23:54 -04:00 committed by Carlton Gibson
parent 97f124f39e
commit 2a5d2eefc7
2 changed files with 14 additions and 0 deletions

View File

@ -11,6 +11,7 @@ from django.http.response import (
Http404, Http404,
HttpResponse, HttpResponse,
HttpResponseBadRequest, HttpResponseBadRequest,
HttpResponseBase,
HttpResponseForbidden, HttpResponseForbidden,
HttpResponseGone, HttpResponseGone,
HttpResponseNotAllowed, HttpResponseNotAllowed,
@ -31,6 +32,7 @@ __all__ = [
"RawPostDataException", "RawPostDataException",
"UnreadablePostError", "UnreadablePostError",
"HttpResponse", "HttpResponse",
"HttpResponseBase",
"StreamingHttpResponse", "StreamingHttpResponse",
"HttpResponseRedirect", "HttpResponseRedirect",
"HttpResponsePermanentRedirect", "HttpResponsePermanentRedirect",

View File

@ -1150,6 +1150,9 @@ the data to the client. Because the content can't be accessed, many
middleware can't function normally. For example the ``ETag`` and middleware can't function normally. For example the ``ETag`` and
``Content-Length`` headers can't be generated for streaming responses. ``Content-Length`` headers can't be generated for streaming responses.
The :class:`HttpResponseBase` base class is common between
:class:`HttpResponse` and :class:`StreamingHttpResponse`.
Attributes Attributes
---------- ----------
@ -1218,3 +1221,12 @@ Methods
This method is automatically called during the response initialization and This method is automatically called during the response initialization and
set various headers (``Content-Length``, ``Content-Type``, and set various headers (``Content-Length``, ``Content-Type``, and
``Content-Disposition``) depending on ``open_file``. ``Content-Disposition``) depending on ``open_file``.
``HttpResponseBase`` class
==========================
.. class:: HttpResponseBase
The :class:`HttpResponseBase` class is common to all Django responses.
It should not be used to create responses directly, but it can be
useful for type-checking.