diff --git a/docs/intro/tutorial01.txt b/docs/intro/tutorial01.txt
index de86571..5437ea5 100644
a
|
b
|
These files are:
|
102 | 102 | anything inside it (e.g. ``mysite.urls``). |
103 | 103 | |
104 | 104 | * :file:`mysite/__init__.py`: An empty file that tells Python that this |
105 | | directory should be considered a Python package. (Read `more about |
106 | | packages`_ in the official Python docs if you're a Python beginner.) |
| 105 | directory should be considered a Python package. If you're a Python beginner, |
| 106 | read :ref:`more about packages <tut-packages>` in the official Python docs. |
107 | 107 | |
108 | 108 | * :file:`mysite/settings.py`: Settings/configuration for this Django |
109 | 109 | project. :doc:`/topics/settings` will tell you all about how settings |
… |
… |
These files are:
|
116 | 116 | * :file:`mysite/wsgi.py`: An entry-point for WSGI-compatible web servers to |
117 | 117 | serve your project. See :doc:`/howto/deployment/wsgi/index` for more details. |
118 | 118 | |
119 | | .. _more about packages: https://docs.python.org/tutorial/modules.html#packages |
120 | | |
121 | 119 | The development server |
122 | 120 | ====================== |
123 | 121 | |
diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
index a244dee..05763cf 100644
a
|
b
|
Default::
|
924 | 924 | |
925 | 925 | A list of formats that will be accepted when inputting data on a date field. |
926 | 926 | Formats will be tried in order, using the first valid one. Note that these |
927 | | format strings use Python's datetime_ module syntax, not the format strings |
928 | | from the ``date`` Django template tag. |
| 927 | format strings use Python's :ref:`datetime module syntax |
| 928 | <strftime-strptime-behavior>`, not the format strings from the :tfilter:`date` |
| 929 | template filter. |
929 | 930 | |
930 | 931 | When :setting:`USE_L10N` is ``True``, the locale-dictated format has higher |
931 | 932 | precedence and will be applied instead. |
932 | 933 | |
933 | 934 | See also :setting:`DATETIME_INPUT_FORMATS` and :setting:`TIME_INPUT_FORMATS`. |
934 | 935 | |
935 | | .. _datetime: https://docs.python.org/library/datetime.html#strftime-strptime-behavior |
936 | | |
937 | 936 | .. setting:: DATETIME_FORMAT |
938 | 937 | |
939 | 938 | ``DATETIME_FORMAT`` |
… |
… |
Default::
|
972 | 971 | |
973 | 972 | A list of formats that will be accepted when inputting data on a datetime |
974 | 973 | field. Formats will be tried in order, using the first valid one. Note that |
975 | | these format strings use Python's datetime_ module syntax, not the format |
976 | | strings from the ``date`` Django template tag. |
| 974 | these format strings use Python's :ref:`datetime module syntax |
| 975 | <strftime-strptime-behavior>`, not the format strings from the :tfilter:`date` |
| 976 | template filter. |
977 | 977 | |
978 | 978 | When :setting:`USE_L10N` is ``True``, the locale-dictated format has higher |
979 | 979 | precedence and will be applied instead. |
diff --git a/docs/ref/utils.txt b/docs/ref/utils.txt
index 202cbb4..72bd98d 100644
a
|
b
|
escaping HTML.
|
619 | 619 | |
620 | 620 | .. function:: format_html(format_string, *args, **kwargs) |
621 | 621 | |
622 | | This is similar to `str.format`_, except that it is appropriate for |
| 622 | This is similar to :meth:`str.format`, except that it is appropriate for |
623 | 623 | building up HTML fragments. All args and kwargs are passed through |
624 | | :func:`conditional_escape` before being passed to ``str.format``. |
| 624 | :func:`conditional_escape` before being passed to ``str.format()``. |
625 | 625 | |
626 | 626 | For the case of building up small HTML fragments, this function is to be |
627 | | preferred over string interpolation using ``%`` or ``str.format`` directly, |
628 | | because it applies escaping to all arguments - just like the Template system |
629 | | applies escaping by default. |
| 627 | preferred over string interpolation using ``%`` or ``str.format()`` |
| 628 | directly, because it applies escaping to all arguments - just like the |
| 629 | template system applies escaping by default. |
630 | 630 | |
631 | 631 | So, instead of writing:: |
632 | 632 | |
633 | | mark_safe("%s <b>%s</b> %s" % (some_html, |
634 | | escape(some_text), |
635 | | escape(some_other_text), |
636 | | )) |
| 633 | mark_safe("%s <b>%s</b> %s" % (some_html, escape(some_text), escape(some_other_text))) |
637 | 634 | |
638 | 635 | You should instead use:: |
639 | 636 | |
640 | | format_html("{} <b>{}</b> {}", |
641 | | mark_safe(some_html), some_text, some_other_text) |
| 637 | format_html("{} <b>{}</b> {}", mark_safe(some_html), some_text, some_other_text) |
642 | 638 | |
643 | 639 | This has the advantage that you don't need to apply :func:`escape` to each |
644 | 640 | argument and risk a bug and an XSS vulnerability if you forget one. |
645 | 641 | |
646 | 642 | Note that although this function uses ``str.format`` to do the |
647 | | interpolation, some of the formatting options provided by `str.format`_ |
| 643 | interpolation, some of the formatting options provided by :meth:`str.format` |
648 | 644 | (e.g. number formatting) will not work, since all arguments are passed |
649 | 645 | through :func:`conditional_escape` which (ultimately) calls |
650 | 646 | :func:`~django.utils.encoding.force_text` on the values. |
651 | 647 | |
652 | | .. _str.format: https://docs.python.org/library/stdtypes.html#str.format |
653 | | |
654 | 648 | .. function:: format_html_join(sep, format_string, args_generator) |
655 | 649 | |
656 | 650 | A wrapper of :func:`format_html`, for the common case of a group of |
… |
… |
escaping HTML.
|
661 | 655 | ``args_generator`` should be an iterator that returns the sequence of |
662 | 656 | ``args`` that will be passed to :func:`format_html`. For example:: |
663 | 657 | |
664 | | format_html_join('\n', "<li>{} {}</li>", ((u.first_name, u.last_name) |
665 | | for u in users)) |
| 658 | format_html_join('\n', "<li>{} {}</li>", ((u.first_name, u.last_name) for u in users)) |
666 | 659 | |
667 | 660 | .. function:: strip_tags(value) |
668 | 661 | |