diff options
| author | Tim Graham <timograham@gmail.com> | 2016-05-08 18:07:43 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-05-08 18:09:10 -0400 |
| commit | 145572adb386dc05bc1302bee4432648b13e7e66 (patch) | |
| tree | c16ab4d1b735d95ab51a845202330f268e7158f8 /docs/ref | |
| parent | 86b346435a6735484c23fc9c798cf5243cbf8124 (diff) | |
[1.9.x] Fixed #26483 -- Updated docs.python.org links to use Intersphinx.
Backport of f5ff5010cd74500785a707ac70b51d292403cddc from master
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/contrib/index.txt | 8 | ||||
| -rw-r--r-- | docs/ref/models/instances.txt | 28 | ||||
| -rw-r--r-- | docs/ref/settings.txt | 27 | ||||
| -rw-r--r-- | docs/ref/templates/builtins.txt | 7 | ||||
| -rw-r--r-- | docs/ref/utils.txt | 14 |
5 files changed, 36 insertions, 48 deletions
diff --git a/docs/ref/contrib/index.txt b/docs/ref/contrib/index.txt index 9df41e4419..deb718b472 100644 --- a/docs/ref/contrib/index.txt +++ b/docs/ref/contrib/index.txt @@ -2,9 +2,9 @@ ``contrib`` packages ==================== -Django aims to follow Python's `"batteries included" philosophy`_. It ships -with a variety of extra, optional tools that solve common Web-development -problems. +Django aims to follow Python's :ref:`"batteries included" philosophy +<tut-batteries-included>`. It ships with a variety of extra, optional tools +that solve common Web-development problems. This code lives in ``django/contrib`` in the Django distribution. This document gives a rundown of the packages in ``contrib``, along with any dependencies @@ -17,8 +17,6 @@ those packages have. ``'django.contrib.redirects'``) to your :setting:`INSTALLED_APPS` setting and re-run ``manage.py migrate``. -.. _"batteries included" philosophy: https://docs.python.org/tutorial/stdlib.html#batteries-included - .. toctree:: :maxdepth: 1 diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt index 7909d9d5c6..5145088401 100644 --- a/docs/ref/models/instances.txt +++ b/docs/ref/models/instances.txt @@ -596,8 +596,8 @@ Other model instance methods A few object methods have special purposes. -``__str__`` ------------ +``__str__()`` +------------- .. method:: Model.__str__() @@ -623,8 +623,8 @@ For example:: If you'd like compatibility with Python 2, you can decorate your model class with :func:`~django.utils.encoding.python_2_unicode_compatible` as shown above. -``__eq__`` ----------- +``__eq__()`` +------------ .. method:: Model.__eq__() @@ -652,22 +652,20 @@ For example:: MyModel(id=1) != MultitableInherited(id=1) MyModel(id=1) != MyModel(id=2) -``__hash__`` ------------- +``__hash__()`` +-------------- .. method:: Model.__hash__() -The ``__hash__`` method is based on the instance's primary key value. It -is effectively hash(obj.pk). If the instance doesn't have a primary key -value then a ``TypeError`` will be raised (otherwise the ``__hash__`` +The ``__hash__()`` method is based on the instance's primary key value. It +is effectively ``hash(obj.pk)``. If the instance doesn't have a primary key +value then a ``TypeError`` will be raised (otherwise the ``__hash__()`` method would return different values before and after the instance is -saved, but changing the ``__hash__`` value of an instance `is forbidden -in Python`_). - -.. _is forbidden in Python: https://docs.python.org/reference/datamodel.html#object.__hash__ +saved, but changing the :meth:`~object.__hash__` value of an instance is +forbidden in Python. -``get_absolute_url`` --------------------- +``get_absolute_url()`` +---------------------- .. method:: Model.get_absolute_url() diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt index 6044c4f7cf..a139f21eba 100644 --- a/docs/ref/settings.txt +++ b/docs/ref/settings.txt @@ -954,16 +954,15 @@ Default:: A list of formats that will be accepted when inputting data on a date field. Formats will be tried in order, using the first valid one. Note that these -format strings use Python's datetime_ module syntax, not the format strings -from the ``date`` Django template tag. +format strings use Python's :ref:`datetime module syntax +<strftime-strptime-behavior>`, not the format strings from the :tfilter:`date` +template filter. When :setting:`USE_L10N` is ``True``, the locale-dictated format has higher precedence and will be applied instead. See also :setting:`DATETIME_INPUT_FORMATS` and :setting:`TIME_INPUT_FORMATS`. -.. _datetime: https://docs.python.org/library/datetime.html#strftime-strptime-behavior - .. setting:: DATETIME_FORMAT ``DATETIME_FORMAT`` @@ -1002,16 +1001,15 @@ Default:: A list of formats that will be accepted when inputting data on a datetime field. Formats will be tried in order, using the first valid one. Note that -these format strings use Python's datetime_ module syntax, not the format -strings from the ``date`` Django template tag. +these format strings use Python's :ref:`datetime module syntax +<strftime-strptime-behavior>`, not the format strings from the :tfilter:`date` +template filter. When :setting:`USE_L10N` is ``True``, the locale-dictated format has higher precedence and will be applied instead. See also :setting:`DATE_INPUT_FORMATS` and :setting:`TIME_INPUT_FORMATS`. -.. _datetime: https://docs.python.org/library/datetime.html#strftime-strptime-behavior - .. setting:: DEBUG ``DEBUG`` @@ -1765,14 +1763,12 @@ __ https://github.com/django/django/blob/master/django/utils/log.py Default: ``'logging.config.dictConfig'`` A path to a callable that will be used to configure logging in the -Django project. Points at a instance of Python's `dictConfig`_ -configuration method by default. +Django project. Points at a instance of Python's :ref:`dictConfig +<logging-config-dictschema>` configuration method by default. If you set :setting:`LOGGING_CONFIG` to ``None``, the logging configuration process will be skipped. -.. _dictConfig: https://docs.python.org/library/logging.config.html#configuration-dictionary-schema - .. setting:: MANAGERS ``MANAGERS`` @@ -2528,16 +2524,15 @@ Default:: A list of formats that will be accepted when inputting data on a time field. Formats will be tried in order, using the first valid one. Note that these -format strings use Python's datetime_ module syntax, not the format strings -from the ``date`` Django template tag. +format strings use Python's :ref:`datetime module syntax +<strftime-strptime-behavior>`, not the format strings from the :tfilter:`date` +template filter. When :setting:`USE_L10N` is ``True``, the locale-dictated format has higher precedence and will be applied instead. See also :setting:`DATE_INPUT_FORMATS` and :setting:`DATETIME_INPUT_FORMATS`. -.. _datetime: https://docs.python.org/library/datetime.html#strftime-strptime-behavior - .. setting:: TIME_ZONE ``TIME_ZONE`` diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt index 12a7b6efb8..0835a50f94 100644 --- a/docs/ref/templates/builtins.txt +++ b/docs/ref/templates/builtins.txt @@ -2055,11 +2055,8 @@ If ``value`` is ``"Joel is a slug"``, the output will be ``"joel-is-a-slug"``. ---------------- Formats the variable according to the argument, a string formatting specifier. -This specifier uses Python string formatting syntax, with the exception that -the leading "%" is dropped. - -See https://docs.python.org/library/stdtypes.html#string-formatting-operations -for documentation of Python string formatting +This specifier uses the :ref:`old-string-formatting` syntax, with the exception +that the leading "%" is dropped. For example:: diff --git a/docs/ref/utils.txt b/docs/ref/utils.txt index ee3054f181..3d6b792263 100644 --- a/docs/ref/utils.txt +++ b/docs/ref/utils.txt @@ -590,14 +590,14 @@ escaping HTML. .. function:: format_html(format_string, *args, **kwargs) - This is similar to `str.format`_, except that it is appropriate for + This is similar to :meth:`str.format`, except that it is appropriate for building up HTML fragments. All args and kwargs are passed through - :func:`conditional_escape` before being passed to ``str.format``. + :func:`conditional_escape` before being passed to ``str.format()``. For the case of building up small HTML fragments, this function is to be - preferred over string interpolation using ``%`` or ``str.format`` directly, - because it applies escaping to all arguments - just like the Template system - applies escaping by default. + preferred over string interpolation using ``%`` or ``str.format()`` + directly, because it applies escaping to all arguments - just like the + template system applies escaping by default. So, instead of writing:: @@ -614,8 +614,8 @@ escaping HTML. This has the advantage that you don't need to apply :func:`escape` to each argument and risk a bug and an XSS vulnerability if you forget one. - Note that although this function uses ``str.format`` to do the - interpolation, some of the formatting options provided by `str.format`_ + Note that although this function uses ``str.format()`` to do the + interpolation, some of the formatting options provided by ``str.format()`` (e.g. number formatting) will not work, since all arguments are passed through :func:`conditional_escape` which (ultimately) calls :func:`~django.utils.encoding.force_text` on the values. |
