mirror of https://github.com/django/django.git
Used :mimetype: role in various docs.
This commit is contained in:
parent
a9337b4add
commit
feb91dbda1
|
@ -243,6 +243,9 @@ documentation:
|
||||||
and try to link to the relevant section if possible. For example, use
|
and try to link to the relevant section if possible. For example, use
|
||||||
``:pep:`20#easter-egg``` or ``:pep:`Easter Egg <20#easter-egg>```.
|
``:pep:`20#easter-egg``` or ``:pep:`Easter Egg <20#easter-egg>```.
|
||||||
|
|
||||||
|
* Use :rst:role:`:mimetype:<mimetype>` to refer to a MIME Type unless the value
|
||||||
|
is quoted for a code example.
|
||||||
|
|
||||||
Django-specific markup
|
Django-specific markup
|
||||||
======================
|
======================
|
||||||
|
|
||||||
|
|
|
@ -1028,7 +1028,7 @@ can create it with the help of :py:class:`http.HTTPStatus`. For example::
|
||||||
response. It inherits most behavior from its superclass with a couple
|
response. It inherits most behavior from its superclass with a couple
|
||||||
differences:
|
differences:
|
||||||
|
|
||||||
Its default ``Content-Type`` header is set to ``application/json``.
|
Its default ``Content-Type`` header is set to :mimetype:`application/json`.
|
||||||
|
|
||||||
The first parameter, ``data``, should be a ``dict`` instance. If the
|
The first parameter, ``data``, should be a ``dict`` instance. If the
|
||||||
``safe`` parameter is set to ``False`` (see below) it can be any
|
``safe`` parameter is set to ``False`` (see below) it can be any
|
||||||
|
|
|
@ -275,8 +275,8 @@ Email
|
||||||
headers in the local time zone rather than in UTC.
|
headers in the local time zone rather than in UTC.
|
||||||
|
|
||||||
* ``EmailMessage.attach()`` and ``attach_file()`` now fall back to MIME type
|
* ``EmailMessage.attach()`` and ``attach_file()`` now fall back to MIME type
|
||||||
``application/octet-stream`` when binary content that can't be decoded as
|
:mimetype:`application/octet-stream` when binary content that can't be
|
||||||
UTF-8 is specified for a ``text/*`` attachment.
|
decoded as UTF-8 is specified for a :mimetype:`text/*` attachment.
|
||||||
|
|
||||||
File Storage
|
File Storage
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
|
|
@ -424,11 +424,11 @@ Non-form data in HTTP requests
|
||||||
:attr:`request.POST <django.http.HttpRequest.POST>` will no longer include data
|
:attr:`request.POST <django.http.HttpRequest.POST>` will no longer include data
|
||||||
posted via HTTP requests with non form-specific content-types in the header.
|
posted via HTTP requests with non form-specific content-types in the header.
|
||||||
In prior versions, data posted with content-types other than
|
In prior versions, data posted with content-types other than
|
||||||
``multipart/form-data`` or ``application/x-www-form-urlencoded`` would still
|
:mimetype:`multipart/form-data` or
|
||||||
end up represented in the :attr:`request.POST <django.http.HttpRequest.POST>`
|
:mimetype:`application/x-www-form-urlencoded` would still end up represented in
|
||||||
attribute. Developers wishing to access the raw POST data for these cases,
|
the :attr:`request.POST <django.http.HttpRequest.POST>` attribute. Developers
|
||||||
should use the :attr:`request.body <django.http.HttpRequest.body>` attribute
|
wishing to access the raw POST data for these cases, should use the
|
||||||
instead.
|
:attr:`request.body <django.http.HttpRequest.body>` attribute instead.
|
||||||
|
|
||||||
:data:`~django.core.signals.request_finished` signal
|
:data:`~django.core.signals.request_finished` signal
|
||||||
----------------------------------------------------
|
----------------------------------------------------
|
||||||
|
|
|
@ -557,7 +557,9 @@ Email
|
||||||
~~~~~
|
~~~~~
|
||||||
|
|
||||||
* :func:`~django.core.mail.send_mail` now accepts an ``html_message``
|
* :func:`~django.core.mail.send_mail` now accepts an ``html_message``
|
||||||
parameter for sending a multipart ``text/plain`` and ``text/html`` email.
|
parameter for sending a multipart :mimetype:`text/plain` and
|
||||||
|
:mimetype:`text/html` email.
|
||||||
|
|
||||||
* The SMTP :class:`~django.core.mail.backends.smtp.EmailBackend` now accepts a
|
* The SMTP :class:`~django.core.mail.backends.smtp.EmailBackend` now accepts a
|
||||||
``timeout`` parameter.
|
``timeout`` parameter.
|
||||||
|
|
||||||
|
|
|
@ -1287,8 +1287,8 @@ implementation details see :ref:`using-the-views`.
|
||||||
default context data passed to the template.
|
default context data passed to the template.
|
||||||
|
|
||||||
* ``html_email_template_name``: The full name of a template to use
|
* ``html_email_template_name``: The full name of a template to use
|
||||||
for generating a ``text/html`` multipart email with the password reset
|
for generating a :mimetype:`text/html` multipart email with the password
|
||||||
link. By default, HTML email is not sent.
|
reset link. By default, HTML email is not sent.
|
||||||
|
|
||||||
* ``extra_email_context``: A dictionary of context data that will be
|
* ``extra_email_context``: A dictionary of context data that will be
|
||||||
available in the email template. It can be used to override default
|
available in the email template. It can be used to override default
|
||||||
|
|
|
@ -341,15 +341,16 @@ The class has the following methods:
|
||||||
|
|
||||||
message.attach('design.png', img_data, 'image/png')
|
message.attach('design.png', img_data, 'image/png')
|
||||||
|
|
||||||
If you specify a ``mimetype`` of ``message/rfc822``, it will also accept
|
If you specify a ``mimetype`` of :mimetype:`message/rfc822`, it will also
|
||||||
:class:`django.core.mail.EmailMessage` and :py:class:`email.message.Message`.
|
accept :class:`django.core.mail.EmailMessage` and
|
||||||
|
:py:class:`email.message.Message`.
|
||||||
|
|
||||||
For a ``mimetype`` starting with ``text/``, content is expected to be a
|
For a ``mimetype`` starting with :mimetype:`text/`, content is expected to
|
||||||
string. Binary data will be decoded using UTF-8, and if that fails, the
|
be a string. Binary data will be decoded using UTF-8, and if that fails,
|
||||||
MIME type will be changed to ``application/octet-stream`` and the data will
|
the MIME type will be changed to :mimetype:`application/octet-stream` and
|
||||||
be attached unchanged.
|
the data will be attached unchanged.
|
||||||
|
|
||||||
In addition, ``message/rfc822`` attachments will no longer be
|
In addition, :mimetype:`message/rfc822` attachments will no longer be
|
||||||
base64-encoded in violation of :rfc:`2046#section-5.2.1`, which can cause
|
base64-encoded in violation of :rfc:`2046#section-5.2.1`, which can cause
|
||||||
issues with displaying the attachments in `Evolution`__ and `Thunderbird`__.
|
issues with displaying the attachments in `Evolution`__ and `Thunderbird`__.
|
||||||
|
|
||||||
|
@ -363,7 +364,7 @@ The class has the following methods:
|
||||||
|
|
||||||
message.attach_file('/images/weather_map.png')
|
message.attach_file('/images/weather_map.png')
|
||||||
|
|
||||||
For MIME types starting with ``text/``, binary data is handled as in
|
For MIME types starting with :mimetype:`text/`, binary data is handled as in
|
||||||
``attach()``.
|
``attach()``.
|
||||||
|
|
||||||
Sending alternative content types
|
Sending alternative content types
|
||||||
|
|
Loading…
Reference in New Issue