mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Converted links to external topics so they use intersphinx extension markup.
This allows to make these links more resilent to changes in the target URLs. Thanks Jannis for the report and Aymeric Augustin for the patch. Fixes #16586. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16720 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
9110257a32
commit
932b1b8d6d
43 changed files with 283 additions and 377 deletions
|
@ -586,10 +586,8 @@ YearMixin
|
|||
|
||||
.. attribute:: year_format
|
||||
|
||||
The strftime_ format to use when parsing the year. By default, this is
|
||||
``'%Y'``.
|
||||
|
||||
.. _strftime: http://docs.python.org/library/time.html#time.strftime
|
||||
The :func:`~time.strftime` format to use when parsing the year.
|
||||
By default, this is ``'%Y'``.
|
||||
|
||||
.. attribute:: year
|
||||
|
||||
|
@ -598,7 +596,7 @@ YearMixin
|
|||
|
||||
.. method:: get_year_format()
|
||||
|
||||
Returns the strftime_ format to use when parsing the year. Returns
|
||||
Returns the :func:`~time.strftime` format to use when parsing the year. Returns
|
||||
:attr:`YearMixin.year_format` by default.
|
||||
|
||||
.. method:: get_year()
|
||||
|
@ -621,7 +619,7 @@ MonthMixin
|
|||
|
||||
.. attribute:: month_format
|
||||
|
||||
The strftime_ format to use when parsing the month. By default, this is
|
||||
The :func:`~time.strftime` format to use when parsing the month. By default, this is
|
||||
``'%b'``.
|
||||
|
||||
.. attribute:: month
|
||||
|
@ -631,7 +629,7 @@ MonthMixin
|
|||
|
||||
.. method:: get_month_format()
|
||||
|
||||
Returns the strftime_ format to use when parsing the month. Returns
|
||||
Returns the :func:`~time.strftime` format to use when parsing the month. Returns
|
||||
:attr:`MonthMixin.month_format` by default.
|
||||
|
||||
.. method:: get_month()
|
||||
|
@ -667,7 +665,7 @@ DayMixin
|
|||
|
||||
.. attribute:: day_format
|
||||
|
||||
The strftime_ format to use when parsing the day. By default, this is
|
||||
The :func:`~time.strftime` format to use when parsing the day. By default, this is
|
||||
``'%d'``.
|
||||
|
||||
.. attribute:: day
|
||||
|
@ -677,7 +675,7 @@ DayMixin
|
|||
|
||||
.. method:: get_day_format()
|
||||
|
||||
Returns the strftime_ format to use when parsing the day. Returns
|
||||
Returns the :func:`~time.strftime` format to use when parsing the day. Returns
|
||||
:attr:`DayMixin.day_format` by default.
|
||||
|
||||
.. method:: get_day()
|
||||
|
@ -712,7 +710,7 @@ WeekMixin
|
|||
|
||||
.. attribute:: week_format
|
||||
|
||||
The strftime_ format to use when parsing the week. By default, this is
|
||||
The :func:`~time.strftime` format to use when parsing the week. By default, this is
|
||||
``'%U'``.
|
||||
|
||||
.. attribute:: week
|
||||
|
@ -722,7 +720,7 @@ WeekMixin
|
|||
|
||||
.. method:: get_week_format()
|
||||
|
||||
Returns the strftime_ format to use when parsing the week. Returns
|
||||
Returns the :func:`~time.strftime` format to use when parsing the week. Returns
|
||||
:attr:`WeekMixin.week_format` by default.
|
||||
|
||||
.. method:: get_week()
|
||||
|
|
|
@ -14,12 +14,12 @@ who visits the malicious site in their browser. A related type of attack,
|
|||
a site with someone else's credentials, is also covered.
|
||||
|
||||
The first defense against CSRF attacks is to ensure that GET requests (and other
|
||||
'safe' methods, as defined by `9.1.1 Safe Methods, HTTP 1.1, RFC 2616`_) are
|
||||
side-effect free. Requests via 'unsafe' methods, such as POST, PUT and DELETE,
|
||||
can then be protected by following the steps below.
|
||||
'safe' methods, as defined by 9.1.1 Safe Methods, HTTP 1.1,
|
||||
:rfc:`2616#section-9.1.1`) are side-effect free. Requests via 'unsafe' methods,
|
||||
such as POST, PUT and DELETE, can then be protected by following the steps
|
||||
below.
|
||||
|
||||
.. _Cross Site Request Forgeries: http://www.squarefree.com/securitytips/web-developers.html#CSRF
|
||||
.. _9.1.1 Safe Methods, HTTP 1.1, RFC 2616: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
|
||||
|
||||
.. _using-csrf:
|
||||
|
||||
|
@ -228,9 +228,9 @@ This ensures that only forms that have originated from your Web site can be used
|
|||
to POST data back.
|
||||
|
||||
It deliberately ignores GET requests (and other requests that are defined as
|
||||
'safe' by RFC 2616). These requests ought never to have any potentially
|
||||
'safe' by :rfc:`2616`). These requests ought never to have any potentially
|
||||
dangerous side effects , and so a CSRF attack with a GET request ought to be
|
||||
harmless. RFC 2616 defines POST, PUT and DELETE as 'unsafe', and all other
|
||||
harmless. :rfc:`2616` defines POST, PUT and DELETE as 'unsafe', and all other
|
||||
methods are assumed to be unsafe, for maximum protection.
|
||||
|
||||
Caching
|
||||
|
|
|
@ -1235,13 +1235,17 @@ may be executed from the SQL Shell as the ``postgres`` user::
|
|||
postgres# CREATE DATABASE geodjango OWNER geodjango TEMPLATE template_postgis ENCODING 'utf8';
|
||||
|
||||
.. rubric:: Footnotes
|
||||
.. [#] The datum shifting files are needed for converting data to and from certain projections.
|
||||
For example, the PROJ.4 string for the `Google projection (900913) <http://spatialreference.org/ref/epsg/900913/proj4>`_
|
||||
requires the ``null`` grid file only included in the extra datum shifting files.
|
||||
It is easier to install the shifting files now, then to have debug a problem caused by their absence later.
|
||||
.. [#] Specifically, GeoDjango provides support for the `OGR <http://gdal.org/ogr>`_ library, a component of GDAL.
|
||||
.. [#] The datum shifting files are needed for converting data to and from
|
||||
certain projections.
|
||||
For example, the PROJ.4 string for the `Google projection (900913)
|
||||
<http://spatialreference.org/ref/epsg/900913/proj4>`_ requires the
|
||||
``null`` grid file only included in the extra datum shifting files.
|
||||
It is easier to install the shifting files now, then to have debug a
|
||||
problem caused by their absence later.
|
||||
.. [#] Specifically, GeoDjango provides support for the `OGR
|
||||
<http://gdal.org/ogr>`_ library, a component of GDAL.
|
||||
.. [#] See `GDAL ticket #2382 <http://trac.osgeo.org/gdal/ticket/2382>`_.
|
||||
.. [#] GeoDjango uses the `find_library <http://docs.python.org/library/ctypes.html#finding-shared-libraries>`_
|
||||
routine from ``ctypes.util`` to locate shared libraries.
|
||||
.. [#] GeoDjango uses the :func:`~ctypes.util.find_library` routine from
|
||||
:mod:`ctypes.util` to locate shared libraries.
|
||||
.. [#] The ``psycopg2`` Windows installers are packaged and maintained by
|
||||
`Jason Erickson <http://www.stickpeople.com/projects/python/win-psycopg/>`_.
|
||||
|
|
|
@ -852,8 +852,9 @@ They share this interface:
|
|||
|
||||
All parameters, if given, should be Unicode objects, except:
|
||||
|
||||
* ``pubdate`` should be a `Python datetime object`_.
|
||||
* ``enclosure`` should be an instance of ``feedgenerator.Enclosure``.
|
||||
* ``pubdate`` should be a Python :class:`~datetime.datetime` object.
|
||||
* ``enclosure`` should be an instance of
|
||||
:class:`django.utils.feedgenerator.Enclosure`.
|
||||
* ``categories`` should be a sequence of Unicode objects.
|
||||
|
||||
:meth:`.SyndicationFeed.write`
|
||||
|
@ -884,7 +885,6 @@ For example, to create an Atom 1.0 feed and print it to standard output::
|
|||
</feed>
|
||||
|
||||
.. _django/utils/feedgenerator.py: http://code.djangoproject.com/browser/django/trunk/django/utils/feedgenerator.py
|
||||
.. _Python datetime object: http://docs.python.org/library/datetime.html#datetime-objects
|
||||
|
||||
.. currentmodule:: django.contrib.syndication
|
||||
|
||||
|
@ -913,9 +913,9 @@ attributes. Thus, you can subclass the appropriate feed generator class
|
|||
|
||||
``SyndicationFeed.add_root_elements(self, handler)``
|
||||
Callback to add elements inside the root feed element
|
||||
(``feed``/``channel``). ``handler`` is an `XMLGenerator`_ from Python's
|
||||
built-in SAX library; you'll call methods on it to add to the XML
|
||||
document in process.
|
||||
(``feed``/``channel``). ``handler`` is an
|
||||
:class:`~xml.sax.saxutils.XMLGenerator` from Python's built-in SAX library;
|
||||
you'll call methods on it to add to the XML document in process.
|
||||
|
||||
``SyndicationFeed.item_attributes(self, item)``
|
||||
Return a ``dict`` of attributes to add to each item (``item``/``entry``)
|
||||
|
@ -945,5 +945,3 @@ For example, you might start implementing an iTunes RSS feed generator like so::
|
|||
|
||||
Obviously there's a lot more work to be done for a complete custom feed class,
|
||||
but the above example should demonstrate the basic idea.
|
||||
|
||||
.. _XMLGenerator: http://docs.python.org/dev/library/xml.sax.utils.html#xml.sax.saxutils.XMLGenerator
|
||||
|
|
|
@ -455,7 +455,7 @@ Example usage::
|
|||
.. django-admin-option:: --ignore
|
||||
|
||||
Use the ``--ignore`` or ``-i`` option to ignore files or directories matching
|
||||
the given `glob-style pattern`_. Use multiple times to ignore more.
|
||||
the given :mod:`glob`-style pattern. Use multiple times to ignore more.
|
||||
|
||||
These patterns are used by default: ``'CVS'``, ``'.*'``, ``'*~'``
|
||||
|
||||
|
@ -463,8 +463,6 @@ Example usage::
|
|||
|
||||
django-admin.py makemessages --locale=en_US --ignore=apps/* --ignore=secret/*.html
|
||||
|
||||
.. _`glob-style pattern`: http://docs.python.org/library/glob.html
|
||||
|
||||
.. django-admin-option:: --no-default-ignore
|
||||
|
||||
Use the ``--no-default-ignore`` option to disable the default values of
|
||||
|
|
|
@ -128,10 +128,8 @@ provided in :mod:`django.db`.
|
|||
.. exception:: IntegrityError
|
||||
|
||||
The Django wrappers for database exceptions behave exactly the same as
|
||||
the underlying database exceptions. See `PEP 249 - Python Database API
|
||||
Specification v2.0`_ for further information.
|
||||
|
||||
.. _`PEP 249 - Python Database API Specification v2.0`: http://www.python.org/dev/peps/pep-0249/
|
||||
the underlying database exceptions. See :pep:`249`, the Python Database API
|
||||
Specification v2.0, for further information.
|
||||
|
||||
.. currentmodule:: django.db.transaction
|
||||
|
||||
|
@ -147,8 +145,6 @@ Transaction Exceptions
|
|||
Python Exceptions
|
||||
=================
|
||||
|
||||
Django raises built-in Python exceptions when appropriate as well. See
|
||||
the Python `documentation`_ for further information on the built-in
|
||||
exceptions.
|
||||
|
||||
.. _`documentation`: http://docs.python.org/lib/module-exceptions.html
|
||||
Django raises built-in Python exceptions when appropriate as well. See the
|
||||
Python documentation for further information on the
|
||||
built-in :mod:`exceptions`.
|
||||
|
|
|
@ -639,13 +639,11 @@ A field containing either an IPv4 or an IPv6 address.
|
|||
* Validates that the given value is a valid IP address.
|
||||
* Error message keys: ``required``, ``invalid``
|
||||
|
||||
The IPv6 address normalization follows `RFC4291 section 2.2`_, including using
|
||||
the IPv4 format suggested in paragraph 3 of that section, like
|
||||
The IPv6 address normalization follows :rfc:`4291#section-2.2` section 2.2,
|
||||
including using the IPv4 format suggested in paragraph 3 of that section, like
|
||||
``::ffff:192.0.2.0``. For example, ``2001:0::0:01`` would be normalized to
|
||||
``2001::1``, and ``::ffff:0a0a:0a0a`` to ``::ffff:10.10.10.10``. All
|
||||
characters are converted to lowercase.
|
||||
|
||||
.. _RFC4291 section 2.2: http://tools.ietf.org/html/rfc4291#section-2.2
|
||||
``2001::1``, and ``::ffff:0a0a:0a0a`` to ``::ffff:10.10.10.10``. All characters
|
||||
are converted to lowercase.
|
||||
|
||||
Takes two optional arguments:
|
||||
|
||||
|
|
|
@ -346,11 +346,11 @@ date in the *future* are not displayed unless you set ``allow_future`` to
|
|||
|
||||
**Optional arguments:**
|
||||
|
||||
* ``month_format``: A format string that regulates what format the
|
||||
``month`` parameter uses. This should be in the syntax accepted by
|
||||
Python's ``time.strftime``. (See the `strftime docs`_.) It's set to
|
||||
``"%b"`` by default, which is a three-letter month abbreviation. To
|
||||
change it to use numbers, use ``"%m"``.
|
||||
* ``month_format``: A format string that regulates what format the ``month``
|
||||
parameter uses. This should be in the syntax accepted by Python's
|
||||
:func:`~time.strftime`. It's set to ``"%b"`` by default, which is a
|
||||
three-letter month abbreviation. To change it to use numbers, use
|
||||
``"%m"``.
|
||||
|
||||
* ``template_name``: The full name of a template to use in rendering the
|
||||
page. This lets you override the default template name (see below).
|
||||
|
@ -415,8 +415,6 @@ In addition to ``extra_context``, the template's context will be:
|
|||
is ``'object'`` by default. If ``template_object_name`` is ``'foo'``,
|
||||
this variable's name will be ``foo_list``.
|
||||
|
||||
.. _strftime docs: http://docs.python.org/library/time.html#time.strftime
|
||||
|
||||
``django.views.generic.date_based.archive_week``
|
||||
------------------------------------------------
|
||||
|
||||
|
@ -516,11 +514,11 @@ you set ``allow_future`` to ``True``.
|
|||
|
||||
**Optional arguments:**
|
||||
|
||||
* ``month_format``: A format string that regulates what format the
|
||||
``month`` parameter uses. This should be in the syntax accepted by
|
||||
Python's ``time.strftime``. (See the `strftime docs`_.) It's set to
|
||||
``"%b"`` by default, which is a three-letter month abbreviation. To
|
||||
change it to use numbers, use ``"%m"``.
|
||||
* ``month_format``: A format string that regulates what format the ``month``
|
||||
parameter uses. This should be in the syntax accepted by Python's
|
||||
:func:`~time.strftime`. It's set to ``"%b"`` by default, which is a
|
||||
three-letter month abbreviation. To change it to use numbers, use
|
||||
``"%m"``.
|
||||
|
||||
* ``day_format``: Like ``month_format``, but for the ``day`` parameter.
|
||||
It defaults to ``"%d"`` (day of the month as a decimal number, 01-31).
|
||||
|
@ -624,11 +622,11 @@ future, the view will throw a 404 error by default, unless you set
|
|||
|
||||
**Optional arguments:**
|
||||
|
||||
* ``month_format``: A format string that regulates what format the
|
||||
``month`` parameter uses. This should be in the syntax accepted by
|
||||
Python's ``time.strftime``. (See the `strftime docs`_.) It's set to
|
||||
``"%b"`` by default, which is a three-letter month abbreviation. To
|
||||
change it to use numbers, use ``"%m"``.
|
||||
* ``month_format``: A format string that regulates what format the ``month``
|
||||
parameter uses. This should be in the syntax accepted by Python's
|
||||
:func:`~time.strftime`. It's set to ``"%b"`` by default, which is a
|
||||
three-letter month abbreviation. To change it to use numbers, use
|
||||
``"%m"``.
|
||||
|
||||
* ``day_format``: Like ``month_format``, but for the ``day`` parameter.
|
||||
It defaults to ``"%d"`` (day of the month as a decimal number, 01-31).
|
||||
|
|
|
@ -500,9 +500,9 @@ Has one **required** argument:
|
|||
setting to determine the value of the :attr:`~django.core.files.File.url`
|
||||
attribute.
|
||||
|
||||
This path may contain `strftime formatting`_, which will be replaced by the
|
||||
date/time of the file upload (so that uploaded files don't fill up the given
|
||||
directory).
|
||||
This path may contain :func:`~time.strftime` formatting, which will be
|
||||
replaced by the date/time of the file upload (so that uploaded files don't
|
||||
fill up the given directory).
|
||||
|
||||
This may also be a callable, such as a function, which will be called to
|
||||
obtain the upload path, including the filename. This callable must be able
|
||||
|
@ -560,10 +560,10 @@ takes a few steps:
|
|||
|
||||
For example, say your :setting:`MEDIA_ROOT` is set to ``'/home/media'``, and
|
||||
:attr:`~FileField.upload_to` is set to ``'photos/%Y/%m/%d'``. The ``'%Y/%m/%d'``
|
||||
part of :attr:`~FileField.upload_to` is `strftime formatting`_; ``'%Y'`` is the
|
||||
four-digit year, ``'%m'`` is the two-digit month and ``'%d'`` is the two-digit
|
||||
day. If you upload a file on Jan. 15, 2007, it will be saved in the directory
|
||||
``/home/media/photos/2007/01/15``.
|
||||
part of :attr:`~FileField.upload_to` is :func:`~time.strftime` formatting;
|
||||
``'%Y'`` is the four-digit year, ``'%m'`` is the two-digit month and ``'%d'`` is
|
||||
the two-digit day. If you upload a file on Jan. 15, 2007, it will be saved in
|
||||
the directory ``/home/media/photos/2007/01/15``.
|
||||
|
||||
If you wanted to retrieve the uploaded file's on-disk filename, or the file's
|
||||
size, you could use the :attr:`~django.core.files.File.name` and
|
||||
|
@ -595,8 +595,6 @@ By default, :class:`FileField` instances are
|
|||
created as ``varchar(100)`` columns in your database. As with other fields, you
|
||||
can change the maximum length using the :attr:`~CharField.max_length` argument.
|
||||
|
||||
.. _`strftime formatting`: http://docs.python.org/library/time.html#time.strftime
|
||||
|
||||
FileField and FieldFile
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -711,11 +709,8 @@ The admin represents this as an ``<input type="text">`` (a single-line input).
|
|||
:class:`DecimalField` class. Although they both represent real numbers, they
|
||||
represent those numbers differently. ``FloatField`` uses Python's ``float``
|
||||
type internally, while ``DecimalField`` uses Python's ``Decimal`` type. For
|
||||
information on the difference between the two, see Python's documentation on
|
||||
`Decimal fixed point and floating point arithmetic`_.
|
||||
|
||||
.. _Decimal fixed point and floating point arithmetic: http://docs.python.org/library/decimal.html
|
||||
|
||||
information on the difference between the two, see Python's documentation
|
||||
for the :mod:`decimal` module.
|
||||
|
||||
``ImageField``
|
||||
--------------
|
||||
|
@ -777,13 +772,11 @@ An IPv4 or IPv6 address, in string format (e.g. ``192.0.2.30`` or
|
|||
``2a02:42fe::4``). The admin represents this as an ``<input type="text">``
|
||||
(a single-line input).
|
||||
|
||||
The IPv6 address normalization follows `RFC4291 section 2.2`_, including using
|
||||
the IPv4 format suggested in paragraph 3 of that section, like
|
||||
The IPv6 address normalization follows :rfc:`4291#section-2.2` section 2.2,
|
||||
including using the IPv4 format suggested in paragraph 3 of that section, like
|
||||
``::ffff:192.0.2.0``. For example, ``2001:0::0:01`` would be normalized to
|
||||
``2001::1``, and ``::ffff:0a0a:0a0a`` to ``::ffff:10.10.10.10``. All
|
||||
characters are converted to lowercase.
|
||||
|
||||
.. _RFC4291 section 2.2: http://tools.ietf.org/html/rfc4291#section-2.2
|
||||
``2001::1``, and ``::ffff:0a0a:0a0a`` to ``::ffff:10.10.10.10``. All characters
|
||||
are converted to lowercase.
|
||||
|
||||
.. attribute:: GenericIPAddressField.protocol
|
||||
|
||||
|
|
|
@ -454,7 +454,7 @@ in ``get_absolute_url()`` and have all your other code call that one place.
|
|||
|
||||
.. note::
|
||||
The string you return from ``get_absolute_url()`` **must** contain only
|
||||
ASCII characters (required by the URI specfication, `RFC 2396`_) and be
|
||||
ASCII characters (required by the URI specfication, :rfc:`2396`) and be
|
||||
URL-encoded, if necessary.
|
||||
|
||||
Code and templates calling ``get_absolute_url()`` should be able to use the
|
||||
|
@ -463,8 +463,6 @@ in ``get_absolute_url()`` and have all your other code call that one place.
|
|||
are using unicode strings containing characters outside the ASCII range at
|
||||
all.
|
||||
|
||||
.. _RFC 2396: http://www.ietf.org/rfc/rfc2396.txt
|
||||
|
||||
The ``permalink`` decorator
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ You can evaluate a ``QuerySet`` in the following ways:
|
|||
Pickling QuerySets
|
||||
------------------
|
||||
|
||||
If you pickle_ a ``QuerySet``, this will force all the results to be loaded
|
||||
If you :mod:`pickle` a ``QuerySet``, this will force all the results to be loaded
|
||||
into memory prior to pickling. Pickling is usually used as a precursor to
|
||||
caching and when the cached queryset is reloaded, you want the results to
|
||||
already be present and ready for use (reading from the database can take some
|
||||
|
@ -112,8 +112,6 @@ described here.
|
|||
Django version N+1. Pickles should not be used as part of a long-term
|
||||
archival strategy.
|
||||
|
||||
.. _pickle: http://docs.python.org/library/pickle.html
|
||||
|
||||
.. _queryset-api:
|
||||
|
||||
QuerySet API
|
||||
|
@ -1210,20 +1208,18 @@ iterator
|
|||
|
||||
.. method:: iterator()
|
||||
|
||||
Evaluates the ``QuerySet`` (by performing the query) and returns an `iterator`_
|
||||
over the results. A ``QuerySet`` typically caches its results internally so
|
||||
that repeated evaluations do not result in additional queries. In contrast,
|
||||
``iterator()`` will read results directly, without doing any caching at the
|
||||
``QuerySet`` level (internally, the default iterator calls ``iterator()`` and
|
||||
caches the return value). For a ``QuerySet`` which returns a large number of
|
||||
Evaluates the ``QuerySet`` (by performing the query) and returns an iterator
|
||||
(see :pep:`234`) over the results. A ``QuerySet`` typically caches its results
|
||||
internally so that repeated evaluations do not result in additional queries. In
|
||||
contrast, ``iterator()`` will read results directly, without doing any caching
|
||||
at the ``QuerySet`` level (internally, the default iterator calls ``iterator()``
|
||||
and caches the return value). For a ``QuerySet`` which returns a large number of
|
||||
objects that you only need to access once, this can results in better
|
||||
performance and a significant reduction in memory.
|
||||
|
||||
Note that using ``iterator()`` on a ``QuerySet`` which has already been
|
||||
evaluated will force it to evaluate again, repeating the query.
|
||||
|
||||
.. _iterator: http://www.python.org/dev/peps/pep-0234/
|
||||
|
||||
latest
|
||||
~~~~~~
|
||||
|
||||
|
|
|
@ -196,9 +196,7 @@ Methods
|
|||
Returns the originating host of the request using information from the
|
||||
``HTTP_X_FORWARDED_HOST`` and ``HTTP_HOST`` headers (in that order). If
|
||||
they don't provide a value, the method uses a combination of
|
||||
``SERVER_NAME`` and ``SERVER_PORT`` as detailed in `PEP 333`_.
|
||||
|
||||
.. _PEP 333: http://www.python.org/dev/peps/pep-0333/
|
||||
``SERVER_NAME`` and ``SERVER_PORT`` as detailed in :pep:`3333`.
|
||||
|
||||
Example: ``"127.0.0.1:8000"``
|
||||
|
||||
|
@ -645,7 +643,7 @@ Methods
|
|||
``expires``, and the auto-calculation of ``max_age`` in such case
|
||||
was added. The ``httponly`` argument was also added.
|
||||
|
||||
Sets a cookie. The parameters are the same as in the `cookie Morsel`_
|
||||
Sets a cookie. The parameters are the same as in the :class:`Cookie.Morsel`
|
||||
object in the Python standard library.
|
||||
|
||||
* ``max_age`` should be a number of seconds, or ``None`` (default) if
|
||||
|
@ -664,13 +662,12 @@ Methods
|
|||
JavaScript from having access to the cookie.
|
||||
|
||||
HTTPOnly_ is a flag included in a Set-Cookie HTTP response
|
||||
header. It is not part of the RFC2109 standard for cookies,
|
||||
header. It is not part of the :rfc:`2109` standard for cookies,
|
||||
and it isn't honored consistently by all browsers. However,
|
||||
when it is honored, it can be a useful way to mitigate the
|
||||
risk of client side script accessing the protected cookie
|
||||
data.
|
||||
|
||||
.. _`cookie Morsel`: http://docs.python.org/library/cookie.html#Cookie.Morsel
|
||||
.. _HTTPOnly: http://www.owasp.org/index.php/HTTPOnly
|
||||
|
||||
.. method:: HttpResponse.set_signed_cookie(key, value='', salt='', max_age=None, expires=None, path='/', domain=None, secure=None, httponly=False)
|
||||
|
|
|
@ -1010,8 +1010,8 @@ FILE_UPLOAD_PERMISSIONS
|
|||
Default: ``None``
|
||||
|
||||
The numeric mode (i.e. ``0644``) to set newly uploaded files to. For
|
||||
more information about what these modes mean, see the `documentation for
|
||||
os.chmod`_
|
||||
more information about what these modes mean, see the documentation for
|
||||
:func:`os.chmod`.
|
||||
|
||||
If this isn't given or is ``None``, you'll get operating-system
|
||||
dependent behavior. On most platforms, temporary files will have a mode
|
||||
|
@ -1028,8 +1028,6 @@ system's standard umask.
|
|||
get totally incorrect behavior.
|
||||
|
||||
|
||||
.. _documentation for os.chmod: http://docs.python.org/library/os.html#os.chmod
|
||||
|
||||
.. setting:: FILE_UPLOAD_TEMP_DIR
|
||||
|
||||
FILE_UPLOAD_TEMP_DIR
|
||||
|
@ -1586,7 +1584,7 @@ Whether to use HTTPOnly flag on the session cookie. If this is set to
|
|||
session cookie.
|
||||
|
||||
HTTPOnly_ is a flag included in a Set-Cookie HTTP response header. It
|
||||
is not part of the RFC2109 standard for cookies, and it isn't honored
|
||||
is not part of the :rfc:`2109` standard for cookies, and it isn't honored
|
||||
consistently by all browsers. However, when it is honored, it can be a
|
||||
useful way to mitigate the risk of client side script accessing the
|
||||
protected cookie data.
|
||||
|
|
|
@ -1254,7 +1254,8 @@ Available format strings:
|
|||
c ISO 8601 format. (Note: unlike others ``2008-01-02T10:30:00.000123+02:00``,
|
||||
formatters, such as "Z", "O" or "r", or ``2008-01-02T10:30:00.000123`` if the datetime is naive
|
||||
the "c" formatter will not add timezone
|
||||
offset if value is a `naive datetime`_.)
|
||||
offset if value is a naive datetime
|
||||
(see :class:`datetime.tzinfo`).
|
||||
d Day of the month, 2 digits with ``'01'`` to ``'31'``
|
||||
leading zeros.
|
||||
D Day of the week, textual, 3 letters. ``'Fri'``
|
||||
|
@ -1288,7 +1289,7 @@ Available format strings:
|
|||
if they're zero and the special-case
|
||||
strings 'midnight' and 'noon' if
|
||||
appropriate. Proprietary extension.
|
||||
r RFC 2822 formatted date. ``'Thu, 21 Dec 2000 16:01:07 +0200'``
|
||||
r :rfc:`2822` formatted date. ``'Thu, 21 Dec 2000 16:01:07 +0200'``
|
||||
s Seconds, 2 digits with leading zeros. ``'00'`` to ``'59'``
|
||||
S English ordinal suffix for day of the ``'st'``, ``'nd'``, ``'rd'`` or ``'th'``
|
||||
month, 2 characters.
|
||||
|
@ -1346,8 +1347,6 @@ used, without applying any localization.
|
|||
.. versionchanged:: 1.2
|
||||
Predefined formats can now be influenced by the current locale.
|
||||
|
||||
.. _naive datetime: http://docs.python.org/library/datetime.html#datetime.tzinfo
|
||||
|
||||
.. templatefilter:: default
|
||||
|
||||
default
|
||||
|
@ -1815,9 +1814,7 @@ Example::
|
|||
pprint
|
||||
^^^^^^
|
||||
|
||||
A wrapper around `pprint.pprint`__ -- for debugging, really.
|
||||
|
||||
__ http://docs.python.org/library/pprint.html
|
||||
A wrapper around :func:`pprint.pprint` -- for debugging, really.
|
||||
|
||||
.. templatefilter:: random
|
||||
|
||||
|
|
|
@ -148,13 +148,12 @@ URI and IRI handling
|
|||
Web frameworks have to deal with URLs (which are a type of IRI_). One
|
||||
requirement of URLs is that they are encoded using only ASCII characters.
|
||||
However, in an international environment, you might need to construct a
|
||||
URL from an IRI_ -- very loosely speaking, a URI that can contain Unicode
|
||||
URL from an IRI_ -- very loosely speaking, a URI_ that can contain Unicode
|
||||
characters. Quoting and converting an IRI to URI can be a little tricky, so
|
||||
Django provides some assistance.
|
||||
|
||||
* The function ``django.utils.encoding.iri_to_uri()`` implements the
|
||||
conversion from IRI to URI as required by the specification (`RFC
|
||||
3987`_).
|
||||
conversion from IRI to URI as required by the specification (:rfc:`3987`).
|
||||
|
||||
* The functions ``django.utils.http.urlquote()`` and
|
||||
``django.utils.http.urlquote_plus()`` are versions of Python's standard
|
||||
|
@ -203,7 +202,6 @@ double-quoting problems.
|
|||
|
||||
.. _URI: http://www.ietf.org/rfc/rfc2396.txt
|
||||
.. _IRI: http://www.ietf.org/rfc/rfc3987.txt
|
||||
.. _RFC 3987: IRI_
|
||||
|
||||
Models
|
||||
======
|
||||
|
|
|
@ -21,9 +21,8 @@ managing the ``Vary`` header of responses. It includes functions to patch the
|
|||
header of response objects directly and decorators that change functions to do
|
||||
that header-patching themselves.
|
||||
|
||||
For information on the ``Vary`` header, see `RFC 2616 section 14.44`_.
|
||||
|
||||
.. _RFC 2616 section 14.44: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.44
|
||||
For information on the ``Vary`` header, see :rfc:`2616#section-14.44` section
|
||||
14.44.
|
||||
|
||||
Essentially, the ``Vary`` HTTP header defines which headers a cache should take
|
||||
into account when building its cache key. Requests with the same path but
|
||||
|
@ -179,11 +178,9 @@ results. Instead do::
|
|||
Convert an Internationalized Resource Identifier (IRI) portion to a URI
|
||||
portion that is suitable for inclusion in a URL.
|
||||
|
||||
This is the algorithm from section 3.1 of `RFC 3987`_. However, since we
|
||||
are assuming input is either UTF-8 or unicode already, we can simplify
|
||||
things a little from the full method.
|
||||
|
||||
.. _RFC 3987: http://www.ietf.org/rfc/rfc3987.txt
|
||||
This is the algorithm from section 3.1 of :rfc:`3987#section-3.1`. However,
|
||||
since we are assuming input is either UTF-8 or unicode already, we can
|
||||
simplify things a little from the full method.
|
||||
|
||||
Returns an ASCII string containing the encoded result.
|
||||
|
||||
|
@ -397,10 +394,8 @@ Atom1Feed
|
|||
|
||||
.. function:: http_date(epoch_seconds=None)
|
||||
|
||||
Formats the time to match the RFC 1123 date format as specified by HTTP
|
||||
`RFC 2616`_ section 3.3.1.
|
||||
|
||||
.. _RFC 2616: http://www.w3.org/Protocols/rfc2616/rfc2616.txt
|
||||
Formats the time to match the :rfc:`1123` date format as specified by HTTP
|
||||
:rfc:`2616#section-3.3.1` section 3.3.1.
|
||||
|
||||
Accepts a floating point number expressed in seconds since the epoch in
|
||||
UTC--such as that outputted by ``time.time()``. If set to ``None``,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue