diff options
| author | Elif T. Kus <elifkus@gmail.com> | 2016-01-03 12:56:22 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-01-22 12:12:17 -0500 |
| commit | bca9faae95db2a92e540fbd08505c134639916fe (patch) | |
| tree | 92b34dd8ecf8cf5432c25d43292ebc83b7919350 /docs/ref/templates | |
| parent | 79d0a4fdb0d13ba6a843dace2b90ab44e856bd85 (diff) | |
Fixed #26020 -- Normalized header stylings in docs.
Diffstat (limited to 'docs/ref/templates')
| -rw-r--r-- | docs/ref/templates/builtins.txt | 212 |
1 files changed, 106 insertions, 106 deletions
diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt index b5b2f621b4..bbc3ef063c 100644 --- a/docs/ref/templates/builtins.txt +++ b/docs/ref/templates/builtins.txt @@ -10,14 +10,14 @@ documentation for any custom tags or filters installed. .. _ref-templates-builtins-tags: Built-in tag reference ----------------------- +====================== .. highlight:: html+django .. templatetag:: autoescape autoescape -^^^^^^^^^^ +---------- Controls the current auto-escaping behavior. This tag takes either ``on`` or ``off`` as an argument and that determines whether auto-escaping is in effect @@ -41,7 +41,7 @@ Sample usage:: .. templatetag:: block block -^^^^^ +----- Defines a block that can be overridden by child templates. See :ref:`Template inheritance <template-inheritance>` for more information. @@ -49,7 +49,7 @@ Defines a block that can be overridden by child templates. See .. templatetag:: comment comment -^^^^^^^ +------- Ignores everything between ``{% comment %}`` and ``{% endcomment %}``. An optional note may be inserted in the first tag. For example, this is @@ -67,7 +67,7 @@ Sample usage:: .. templatetag:: csrf_token csrf_token -^^^^^^^^^^ +---------- This tag is used for CSRF protection, as described in the documentation for :doc:`Cross Site Request Forgeries </ref/csrf>`. @@ -75,7 +75,7 @@ This tag is used for CSRF protection, as described in the documentation for .. templatetag:: cycle cycle -^^^^^ +----- Produces one of its arguments each time this tag is encountered. The first argument is produced on the first encounter, the second argument on the second @@ -188,7 +188,7 @@ call to ``{% cycle %}`` doesn't specify ``silent``:: .. templatetag:: debug debug -^^^^^ +----- Outputs a whole load of debugging information, including the current context and imported modules. @@ -196,7 +196,7 @@ and imported modules. .. templatetag:: extends extends -^^^^^^^ +------- Signals that this template extends a parent template. @@ -215,7 +215,7 @@ See :ref:`template-inheritance` for more information. .. templatetag:: filter filter -^^^^^^ +------ Filters the contents of the block through one or more filters. Multiple filters can be specified with pipes and filters can have arguments, just as @@ -239,7 +239,7 @@ Sample usage:: .. templatetag:: firstof firstof -^^^^^^^ +------- Outputs the first argument variable that is not ``False``. Outputs nothing if all the passed variables are ``False``. @@ -283,7 +283,7 @@ output inside a variable. .. templatetag:: for for -^^^ +--- Loops over each item in an array, making the item available in a context variable. For example, to display a list of athletes provided in @@ -341,7 +341,7 @@ Variable Description ========================== =============================================== for ... empty -^^^^^^^^^^^^^ +------------- The ``for`` tag can take an optional ``{% empty %}`` clause whose text is displayed if the given array is empty or could not be found:: @@ -370,7 +370,7 @@ than -- the following:: .. templatetag:: if if -^^ +-- The ``{% if %}`` tag evaluates a variable, and if that variable is "true" (i.e. exists, is not empty, and is not a false boolean value) the contents of the @@ -392,7 +392,7 @@ clauses, as well as an ``{% else %}`` clause that will be displayed if all previous conditions fail. These clauses are optional. Boolean operators -""""""""""""""""" +~~~~~~~~~~~~~~~~~ :ttag:`if` tags may use ``and``, ``or`` or ``not`` to test a number of variables or to negate a given variable:: @@ -435,7 +435,7 @@ them to indicate precedence, you should use nested :ttag:`if` tags. ``<=``, ``>=`` and ``in`` which work as follows: ``==`` operator -~~~~~~~~~~~~~~~ +^^^^^^^^^^^^^^^ Equality. Example:: @@ -444,7 +444,7 @@ Equality. Example:: {% endif %} ``!=`` operator -~~~~~~~~~~~~~~~ +^^^^^^^^^^^^^^^ Inequality. Example:: @@ -454,7 +454,7 @@ Inequality. Example:: {% endif %} ``<`` operator -~~~~~~~~~~~~~~ +^^^^^^^^^^^^^^ Less than. Example:: @@ -463,7 +463,7 @@ Less than. Example:: {% endif %} ``>`` operator -~~~~~~~~~~~~~~ +^^^^^^^^^^^^^^ Greater than. Example:: @@ -472,7 +472,7 @@ Greater than. Example:: {% endif %} ``<=`` operator -~~~~~~~~~~~~~~~ +^^^^^^^^^^^^^^^ Less than or equal to. Example:: @@ -481,7 +481,7 @@ Less than or equal to. Example:: {% endif %} ``>=`` operator -~~~~~~~~~~~~~~~ +^^^^^^^^^^^^^^^ Greater than or equal to. Example:: @@ -490,7 +490,7 @@ Greater than or equal to. Example:: {% endif %} ``in`` operator -~~~~~~~~~~~~~~~ +^^^^^^^^^^^^^^^ Contained within. This operator is supported by many Python containers to test whether the given value is in the container. The following are some examples @@ -511,7 +511,7 @@ of how ``x in y`` will be interpreted:: {% endif %} ``not in`` operator -~~~~~~~~~~~~~~~~~~~ +^^^^^^^^^^^^^^^^^^^ Not contained within. This is the negation of the ``in`` operator. @@ -525,7 +525,7 @@ you should use:: {% if a > b and b > c %} Filters -""""""" +~~~~~~~ You can also use filters in the :ttag:`if` expression. For example:: @@ -534,7 +534,7 @@ You can also use filters in the :ttag:`if` expression. For example:: {% endif %} Complex expressions -""""""""""""""""""" +~~~~~~~~~~~~~~~~~~~ All of the above can be combined to form complex expressions. For such expressions, it can be important to know how the operators are grouped when the @@ -563,7 +563,7 @@ Sometimes that is better for clarity anyway, for the sake of those who do not know the precedence rules. ``ifequal`` and ``ifnotequal`` -"""""""""""""""""""""""""""""" +------------------------------ ``{% ifequal a b %} ... {% endifequal %}`` is an obsolete way to write ``{% if a == b %} ... {% endif %}``. Likewise, ``{% ifnotequal a b %} ... @@ -573,7 +573,7 @@ The ``ifequal`` and ``ifnotequal`` tags will be deprecated in a future release. .. templatetag:: ifchanged ifchanged -^^^^^^^^^ +--------- Check if a value has changed from the last iteration of a loop. @@ -618,7 +618,7 @@ will be displayed if the value has not changed:: .. templatetag:: include include -^^^^^^^ +------- Loads a template and renders it with the current context. This is a way of "including" other templates within a template. @@ -691,7 +691,7 @@ and returns an empty string. .. templatetag:: load load -^^^^ +---- Loads a custom template tag set. @@ -713,7 +713,7 @@ more information. .. templatetag:: lorem lorem -^^^^^ +----- Displays random "lorem ipsum" Latin text. This is useful for providing sample data in templates. @@ -747,7 +747,7 @@ Examples: .. templatetag:: now now -^^^ +--- Displays the current date and/or time, using a format according to the given string. Such string can contain format specifiers characters as described @@ -772,7 +772,7 @@ This would display as "It is the 4th of September". :setting:`DATE_FORMAT`, :setting:`DATETIME_FORMAT`, :setting:`SHORT_DATE_FORMAT` or :setting:`SHORT_DATETIME_FORMAT`. The predefined formats may vary depending on the current locale and - if :ref:`format-localization` is enabled, e.g.:: + if :doc:`/topics/i18n/formatting` is enabled, e.g.:: It is {% now "SHORT_DATETIME_FORMAT" %} @@ -786,7 +786,7 @@ output (as a string) inside a variable. This is useful if you want to use .. templatetag:: regroup regroup -^^^^^^^ +------- Regroups a list of alike objects by a common attribute. @@ -900,7 +900,7 @@ Another solution is to sort the data in the template using the {% regroup cities|dictsort:"country" by country as country_list %} Grouping on other properties -"""""""""""""""""""""""""""" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Any valid template lookup is a legal grouping attribute for the regroup tag, including methods, attributes, dictionary keys and list items. For @@ -922,7 +922,7 @@ attribute, allowing you to group on the display string rather than the .. templatetag:: spaceless spaceless -^^^^^^^^^ +--------- Removes whitespace between HTML tags. This includes tab characters and newlines. @@ -951,7 +951,7 @@ this example, the space around ``Hello`` won't be stripped:: .. templatetag:: templatetag templatetag -^^^^^^^^^^^ +----------- Outputs one of the syntax characters used to compose template tags. @@ -980,7 +980,7 @@ Sample usage:: .. templatetag:: url url -^^^ +--- Returns an absolute path reference (a URL without the domain name) matching a given view and optional parameters. Any special characters in the resulting @@ -1061,7 +1061,7 @@ by the context as to the current application. .. templatetag:: verbatim verbatim -^^^^^^^^ +-------- Stops the template engine from rendering the contents of this block tag. @@ -1082,7 +1082,7 @@ You can also designate a specific closing tag, allowing the use of .. templatetag:: widthratio widthratio -^^^^^^^^^^ +---------- For creating bar charts and such, this tag calculates the ratio of a given value to a maximum value, and then applies that ratio to a constant. @@ -1105,7 +1105,7 @@ variable. It can be useful, for instance, in a :ttag:`blocktrans` like this:: .. templatetag:: with with -^^^^ +---- Caches a complex variable under a simpler name. This is useful when accessing an "expensive" method (e.g., one that hits the database) multiple times. @@ -1131,12 +1131,12 @@ You can assign more than one context variable:: .. _ref-templates-builtins-filters: Built-in filter reference -------------------------- +========================= .. templatefilter:: add add -^^^ +--- Adds the argument to the value. @@ -1166,7 +1166,7 @@ output will be ``[1, 2, 3, 4, 5, 6]``. .. templatefilter:: addslashes addslashes -^^^^^^^^^^ +---------- Adds slashes before quotes. Useful for escaping strings in CSV, for example. @@ -1180,7 +1180,7 @@ If ``value`` is ``"I'm using Django"``, the output will be .. templatefilter:: capfirst capfirst -^^^^^^^^ +-------- Capitalizes the first character of the value. If the first character is not a letter, this filter has no effect. @@ -1194,7 +1194,7 @@ If ``value`` is ``"django"``, the output will be ``"Django"``. .. templatefilter:: center center -^^^^^^ +------ Centers the value in a field of a given width. @@ -1207,7 +1207,7 @@ If ``value`` is ``"Django"``, the output will be ``" Django "``. .. templatefilter:: cut cut -^^^ +--- Removes all values of arg from the given string. @@ -1221,7 +1221,7 @@ If ``value`` is ``"String with spaces"``, the output will be .. templatefilter:: date date -^^^^ +---- Formats a date according to the given format. @@ -1350,7 +1350,7 @@ representation of a ``datetime`` value. E.g.:: .. templatefilter:: default default -^^^^^^^ +------- If value evaluates to ``False``, uses the given default. Otherwise, uses the value. @@ -1364,7 +1364,7 @@ If ``value`` is ``""`` (the empty string), the output will be ``nothing``. .. templatefilter:: default_if_none default_if_none -^^^^^^^^^^^^^^^ +--------------- If (and only if) value is ``None``, uses the given default. Otherwise, uses the value. @@ -1381,7 +1381,7 @@ If ``value`` is ``None``, the output will be the string ``"nothing"``. .. templatefilter:: dictsort dictsort -^^^^^^^^ +-------- Takes a list of dictionaries and returns that list sorted by the key given in the argument. @@ -1435,7 +1435,7 @@ then the output would be:: .. templatefilter:: dictsortreversed dictsortreversed -^^^^^^^^^^^^^^^^ +---------------- Takes a list of dictionaries and returns that list sorted in reverse order by the key given in the argument. This works exactly the same as the above filter, @@ -1444,7 +1444,7 @@ but the returned value will be in reverse order. .. templatefilter:: divisibleby divisibleby -^^^^^^^^^^^ +----------- Returns ``True`` if the value is divisible by the argument. @@ -1457,7 +1457,7 @@ If ``value`` is ``21``, the output would be ``True``. .. templatefilter:: escape escape -^^^^^^ +------ Escapes a string's HTML. Specifically, it makes these replacements: @@ -1486,7 +1486,7 @@ For example, you can apply ``escape`` to fields when :ttag:`autoescape` is off:: .. templatefilter:: escapejs escapejs -^^^^^^^^ +-------- Escapes characters for use in JavaScript strings. This does *not* make the string safe for use in HTML, but does protect you from syntax errors when using @@ -1502,7 +1502,7 @@ the output will be ``"testing\\u000D\\u000Ajavascript \\u0027string\\u0022 \\u00 .. templatefilter:: filesizeformat filesizeformat -^^^^^^^^^^^^^^ +-------------- Formats the value like a 'human-readable' file size (i.e. ``'13 KB'``, ``'4.1 MB'``, ``'102 bytes'``, etc.). @@ -1524,7 +1524,7 @@ If ``value`` is 123456789, the output would be ``117.7 MB``. .. templatefilter:: first first -^^^^^ +----- Returns the first item in a list. @@ -1537,7 +1537,7 @@ If ``value`` is the list ``['a', 'b', 'c']``, the output will be ``'a'``. .. templatefilter:: floatformat floatformat -^^^^^^^^^^^ +----------- When used without an argument, rounds a floating-point number to one decimal place -- but only if there's a decimal part to be displayed. For example: @@ -1590,7 +1590,7 @@ with an argument of ``-1``. .. templatefilter:: force_escape force_escape -^^^^^^^^^^^^ +------------ Applies HTML escaping to a string (see the :tfilter:`escape` filter for details). This filter is applied *immediately* and returns a new, escaped @@ -1608,7 +1608,7 @@ the :tfilter:`linebreaks` filter:: .. templatefilter:: get_digit get_digit -^^^^^^^^^ +--------- Given a whole number, returns the requested digit, where 1 is the right-most digit, 2 is the second-right-most digit, etc. Returns the original value for @@ -1624,7 +1624,7 @@ If ``value`` is ``123456789``, the output will be ``8``. .. templatefilter:: iriencode iriencode -^^^^^^^^^ +--------- Converts an IRI (Internationalized Resource Identifier) to a string that is suitable for including in a URL. This is necessary if you're trying to use @@ -1642,7 +1642,7 @@ If ``value`` is ``"?test=1&me=2"``, the output will be ``"?test=1&me=2"``. .. templatefilter:: join join -^^^^ +---- Joins a list with a string, like Python's ``str.join(list)`` @@ -1656,7 +1656,7 @@ If ``value`` is the list ``['a', 'b', 'c']``, the output will be the string .. templatefilter:: last last -^^^^ +---- Returns the last item in a list. @@ -1670,7 +1670,7 @@ string ``"d"``. .. templatefilter:: length length -^^^^^^ +------ Returns the length of the value. This works for both strings and lists. @@ -1686,7 +1686,7 @@ The filter returns ``0`` for an undefined variable. .. templatefilter:: length_is length_is -^^^^^^^^^ +--------- Returns ``True`` if the value's length is the argument, or ``False`` otherwise. @@ -1700,7 +1700,7 @@ If ``value`` is ``['a', 'b', 'c', 'd']`` or ``"abcd"``, the output will be .. templatefilter:: linebreaks linebreaks -^^^^^^^^^^ +---------- Replaces line breaks in plain text with appropriate HTML; a single newline becomes an HTML line break (``<br />``) and a new line @@ -1716,7 +1716,7 @@ slug</p>``. .. templatefilter:: linebreaksbr linebreaksbr -^^^^^^^^^^^^ +------------ Converts all newlines in a piece of plain text to HTML line breaks (``<br />``). @@ -1731,7 +1731,7 @@ slug``. .. templatefilter:: linenumbers linenumbers -^^^^^^^^^^^ +----------- Displays text with line numbers. @@ -1754,7 +1754,7 @@ the output will be:: .. templatefilter:: ljust ljust -^^^^^ +----- Left-aligns the value in a field of a given width. @@ -1769,7 +1769,7 @@ If ``value`` is ``Django``, the output will be ``"Django "``. .. templatefilter:: lower lower -^^^^^ +----- Converts a string into all lowercase. @@ -1783,7 +1783,7 @@ If ``value`` is ``Totally LOVING this Album!``, the output will be .. templatefilter:: make_list make_list -^^^^^^^^^ +--------- Returns the value turned into a list. For a string, it's a list of characters. For an integer, the argument is cast into an unicode string before creating a @@ -1800,7 +1800,7 @@ list ``['1', '2', '3']``. .. templatefilter:: phone2numeric phone2numeric -^^^^^^^^^^^^^ +------------- Converts a phone number (possibly containing letters) to its numerical equivalent. @@ -1817,7 +1817,7 @@ If ``value`` is ``800-COLLECT``, the output will be ``800-2655328``. .. templatefilter:: pluralize pluralize -^^^^^^^^^ +--------- Returns a plural suffix if the value is not 1. By default, this suffix is ``'s'``. @@ -1848,14 +1848,14 @@ Example:: .. templatefilter:: pprint pprint -^^^^^^ +------ A wrapper around :func:`pprint.pprint` -- for debugging, really. .. templatefilter:: random random -^^^^^^ +------ Returns a random item from the given list. @@ -1868,7 +1868,7 @@ If ``value`` is the list ``['a', 'b', 'c', 'd']``, the output could be ``"b"``. .. templatefilter:: rjust rjust -^^^^^ +----- Right-aligns the value in a field of a given width. @@ -1883,7 +1883,7 @@ If ``value`` is ``Django``, the output will be ``" Django"``. .. templatefilter:: safe safe -^^^^ +---- Marks a string as not requiring further HTML escaping prior to output. When autoescaping is off, this filter has no effect. @@ -1899,7 +1899,7 @@ autoescaping is off, this filter has no effect. .. templatefilter:: safeseq safeseq -^^^^^^^ +------- Applies the :tfilter:`safe` filter to each element of a sequence. Useful in conjunction with other filters that operate on sequences, such as @@ -1914,7 +1914,7 @@ individual elements of the sequence. .. templatefilter:: slice slice -^^^^^ +----- Returns a slice of the list. @@ -1931,7 +1931,7 @@ If ``some_list`` is ``['a', 'b', 'c']``, the output will be ``['a', 'b']``. .. templatefilter:: slugify slugify -^^^^^^^ +------- Converts to ASCII. Converts spaces to hyphens. Removes characters that aren't alphanumerics, underscores, or hyphens. Converts to lowercase. Also strips @@ -1946,7 +1946,7 @@ If ``value`` is ``"Joel is a slug"``, the output will be ``"joel-is-a-slug"``. .. templatefilter:: stringformat stringformat -^^^^^^^^^^^^ +------------ Formats the variable according to the argument, a string formatting specifier. This specifier uses Python string formatting syntax, with the exception that @@ -1964,7 +1964,7 @@ If ``value`` is ``10``, the output will be ``1.000000E+01``. .. templatefilter:: striptags striptags -^^^^^^^^^ +--------- Makes all possible efforts to strip all [X]HTML tags. @@ -1988,7 +1988,7 @@ output will be ``"Joel is a slug"``. .. templatefilter:: time time -^^^^ +---- Formats a time according to the given format. @@ -2034,7 +2034,7 @@ used, without applying any localization. .. templatefilter:: timesince timesince -^^^^^^^^^ +--------- Formats a date as the time since that date (e.g., "4 days, 6 hours"). @@ -2054,7 +2054,7 @@ date that is in the future relative to the comparison point. .. templatefilter:: timeuntil timeuntil -^^^^^^^^^ +--------- Similar to ``timesince``, except that it measures the time from now until the given date or datetime. For example, if today is 1 June 2006 and @@ -2075,7 +2075,7 @@ date that is in the past relative to the comparison point. .. templatefilter:: title title -^^^^^ +----- Converts a string into titlecase by making words start with an uppercase character and the remaining characters lowercase. This tag makes no effort to @@ -2090,7 +2090,7 @@ If ``value`` is ``"my FIRST post"``, the output will be ``"My First Post"``. .. templatefilter:: truncatechars truncatechars -^^^^^^^^^^^^^ +------------- Truncates a string if it is longer than the specified number of characters. Truncated strings will end with a translatable ellipsis sequence ("..."). @@ -2106,7 +2106,7 @@ If ``value`` is ``"Joel is a slug"``, the output will be ``"Joel i..."``. .. templatefilter:: truncatechars_html truncatechars_html -^^^^^^^^^^^^^^^^^^ +------------------ Similar to :tfilter:`truncatechars`, except that it is aware of HTML tags. Any tags that are opened in the string and not closed before the truncation point @@ -2124,7 +2124,7 @@ Newlines in the HTML content will be preserved. .. templatefilter:: truncatewords truncatewords -^^^^^^^^^^^^^ +------------- Truncates a string after a certain number of words. @@ -2141,7 +2141,7 @@ Newlines within the string will be removed. .. templatefilter:: truncatewords_html truncatewords_html -^^^^^^^^^^^^^^^^^^ +------------------ Similar to :tfilter:`truncatewords`, except that it is aware of HTML tags. Any tags that are opened in the string and not closed before the truncation point, @@ -2162,7 +2162,7 @@ Newlines in the HTML content will be preserved. .. templatefilter:: unordered_list unordered_list -^^^^^^^^^^^^^^ +-------------- Recursively takes a self-nested list and returns an HTML unordered list -- WITHOUT opening and closing <ul> tags. @@ -2186,7 +2186,7 @@ contains ``['States', ['Kansas', ['Lawrence', 'Topeka'], 'Illinois']]``, then .. templatefilter:: upper upper -^^^^^ +----- Converts a string into all uppercase. @@ -2199,7 +2199,7 @@ If ``value`` is ``"Joel is a slug"``, the output will be ``"JOEL IS A SLUG"``. .. templatefilter:: urlencode urlencode -^^^^^^^^^ +--------- Escapes a value for use in a URL. @@ -2224,7 +2224,7 @@ If ``value`` is ``"https://www.example.org/"``, the output will be .. templatefilter:: urlize urlize -^^^^^^ +------ Converts URLs and email addresses in text into clickable links. @@ -2268,7 +2268,7 @@ Django's built-in :tfilter:`escape` filter. The default value for .. templatefilter:: urlizetrunc urlizetrunc -^^^^^^^^^^^ +----------- Converts URLs and email addresses into clickable links just like urlize_, but truncates URLs longer than the given character limit. @@ -2289,7 +2289,7 @@ As with urlize_, this filter should only be applied to plain text. .. templatefilter:: wordcount wordcount -^^^^^^^^^ +--------- Returns the number of words. @@ -2302,7 +2302,7 @@ If ``value`` is ``"Joel is a slug"``, the output will be ``4``. .. templatefilter:: wordwrap wordwrap -^^^^^^^^ +-------- Wraps words at specified line length. @@ -2321,7 +2321,7 @@ If ``value`` is ``Joel is a slug``, the output would be:: .. templatefilter:: yesno yesno -^^^^^ +----- Maps values for ``True``, ``False``, and (optionally) ``None``, to the strings "yes", "no", "maybe", or a custom mapping passed as a comma-separated list, and @@ -2343,14 +2343,14 @@ Value Argument Outputs ========== ====================== =========================================== Internationalization tags and filters -------------------------------------- +===================================== Django provides template tags and filters to control each aspect of :doc:`internationalization </topics/i18n/index>` in templates. They allow for granular control of translations, formatting, and time zone conversions. i18n -^^^^ +---- This library allows specifying translatable text in templates. To enable it, set :setting:`USE_I18N` to ``True``, then load it with @@ -2359,7 +2359,7 @@ To enable it, set :setting:`USE_I18N` to ``True``, then load it with See :ref:`specifying-translation-strings-in-template-code`. l10n -^^^^ +---- This library provides control over the localization of values in templates. You only need to load the library using ``{% load l10n %}``, but you'll often @@ -2368,7 +2368,7 @@ set :setting:`USE_L10N` to ``True`` so that localization is active by default. See :ref:`topic-l10n-templates`. tz -^^ +-- This library provides control over time zone conversions in templates. Like ``l10n``, you only need to load the library using ``{% load tz %}``, @@ -2378,25 +2378,25 @@ to local time happens by default. See :ref:`time-zones-in-templates`. Other tags and filters libraries --------------------------------- +================================ Django comes with a couple of other template-tag libraries that you have to enable explicitly in your :setting:`INSTALLED_APPS` setting and enable in your template with the :ttag:`{% load %}<load>` tag. django.contrib.humanize -^^^^^^^^^^^^^^^^^^^^^^^ +----------------------- A set of Django template filters useful for adding a "human touch" to data. See :doc:`/ref/contrib/humanize`. static -^^^^^^ +------ .. templatetag:: static static -"""""" +~~~~~~ To link to static files that are saved in :setting:`STATIC_ROOT` Django ships with a :ttag:`static` template tag. If the :mod:`django.contrib.staticfiles` @@ -2433,7 +2433,7 @@ slightly different call:: .. templatetag:: get_static_prefix get_static_prefix -""""""""""""""""" +~~~~~~~~~~~~~~~~~ You should prefer the :ttag:`static` template tag, but if you need more control over exactly where and how :setting:`STATIC_URL` is injected into the template, @@ -2454,7 +2454,7 @@ the value multiple times:: .. templatetag:: get_media_prefix get_media_prefix -"""""""""""""""" +~~~~~~~~~~~~~~~~ Similar to the :ttag:`get_static_prefix`, ``get_media_prefix`` populates a template variable with the media prefix :setting:`MEDIA_URL`, e.g.:: |
