Skip to content
Myr

Demonstrate in docs how to use registered filters.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Requested by @plaes on #pocoo irc.

authored by Ron DuPlain · committed by Ron DuPlain · parent 8ef2ca9 · Browse files · 1 file+7 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−1 removed

  • other:+7 added−1 removed

1 file+7 added−1 removed

modified:docs/templating.rst+7 added-1 removed
166 unmodified lines
167 return s[::-1]168 app.jinja_env.filters['reverse'] = reverse_filter169170In case of the decorator the argument is optional if you want to use the171function name as name of the filter.171function name as name of the filter. Once registered, you can use the filter172in your templates in the same way as Jinja2's builtin filters, for example if173you have a Python list in context called `mylist`::174175 {% for x in mylist | reverse %}176 {% endfor %}177178179Context Processors180------------------181182To inject new variables automatically into the context of a template
33 unmodified lines