Ticket #8088: templates_doc.diff

File templates_doc.diff, 1.8 KB (added by avsd, 7 years ago)

"cat" filter and "include" tag description update in documentation

  • docs/templates.txt

     
    877877"including" other templates within a template.
    878878
    879879The template name can either be a variable or a hard-coded (quoted) string,
    880 in either single or double quotes.
     880in either single or double quotes. **New in development version:**:
     881Filters may be applied for both variable and hard-coded string.
    881882
    882883This example includes the contents of the template ``"foo/bar.html"``::
    883884
     
    888889
    889890    {% include template_name %}
    890891
     892**New in development version:**: This example includes the content of the
     893template whose name consists of value of the variable, followed by ``.txt``
     894in lowercase::
     895
     896    {% include template_name|lower|stringformat:"s.txt" %}
     897
    891898An included template is rendered with the context of the template that's
    892899including it. This example produces the output ``"Hello, John"``:
    893900
     
    900907
    901908        Hello, {{ person }}
    902909
     910.. admonition:: Warning
     911
     912    Only a hard-coded (quoted) string without any filter as a template name
     913    raises ``TemplateDoesNotExist`` exception in debug mode, if such template
     914    could not be found. In case of variable, or expression
     915    containing filters, Django template system fails silently.
     916
    903917See also: ``{% ssi %}``.
    904918
    905919load
     
    12581272
    12591273Capitalizes the first character of the value.
    12601274
     1275cat
     1276~~~
     1277
     1278**New in Django development version**
     1279
     1280Concatenates given string with argument.
     1281
     1282For example::
     1283   
     1284    {{ value|cat:".txt" }}
     1285
     1286if ``value`` is ``"note"``, the output will be ``note.txt``
     1287
    12611288center
    12621289~~~~~~
    12631290
     
    19481975    * Textile
    19491976    * Markdown
    19501977    * ReST (ReStructured Text)
     1978    * asciidoc
    19511979
    19521980See the `markup section`_ of the `add-ons documentation`_ for more
    19531981information.
Back to Top