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:07:43 -0400 |
| commit | f5ff5010cd74500785a707ac70b51d292403cddc (patch) | |
| tree | 4feba4343be64658742341f0498b599add0c7834 /docs/ref | |
| parent | 413f3bb5c8f29fae08de58d5424b2be185739b32 (diff) | |
Fixed #26483 -- Updated docs.python.org links to use Intersphinx.
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 | 16 |
5 files changed, 36 insertions, 50 deletions
diff --git a/docs/ref/contrib/index.txt b/docs/ref/contrib/index.txt index 350e665e9d..3ae8c4af05 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 e63db64ae0..1dce85794c 100644 --- a/docs/ref/models/instances.txt +++ b/docs/ref/models/instances.txt @@ -599,8 +599,8 @@ Other model instance methods A few object methods have special purposes. -``__str__`` ------------ +``__str__()`` +------------- .. method:: Model.__str__() @@ -626,8 +626,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__() @@ -655,22 +655,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 a244deed44..7423d7d360 100644 --- a/docs/ref/settings.txt +++ b/docs/ref/settings.txt @@ -924,16 +924,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`` @@ -972,16 +971,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`` @@ -1730,14 +1728,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`` @@ -2368,16 +2364,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 ed904b1872..893e094fcc 100644 --- a/docs/ref/templates/builtins.txt +++ b/docs/ref/templates/builtins.txt @@ -2044,11 +2044,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 ed6869e21b..8328d91fc5 100644 --- a/docs/ref/utils.txt +++ b/docs/ref/utils.txt @@ -618,14 +618,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:: @@ -642,14 +642,12 @@ 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. - .. _str.format: https://docs.python.org/library/stdtypes.html#str.format - .. function:: format_html_join(sep, format_string, args_generator) A wrapper of :func:`format_html`, for the common case of a group of |
