Skip to content

Commit

Permalink
Merge pull request #1209 from mhansen/patch-3
Browse files Browse the repository at this point in the history
do_dictsort: update example ready to copy/paste
  • Loading branch information
davidism authored May 16, 2020
2 parents 9ec465b + 4892940 commit 2dd7691
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/jinja2/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,16 +268,16 @@ def do_dictsort(value, case_sensitive=False, by="key", reverse=False):
.. sourcecode:: jinja
{% for item in mydict|dictsort %}
{% for key, value in mydict|dictsort %}
sort the dict by key, case insensitive
{% for item in mydict|dictsort(reverse=true) %}
{% for key, value in mydict|dictsort(reverse=true) %}
sort the dict by key, case insensitive, reverse order
{% for item in mydict|dictsort(true) %}
{% for key, value in mydict|dictsort(true) %}
sort the dict by key, case sensitive
{% for item in mydict|dictsort(false, 'value') %}
{% for key, value in mydict|dictsort(false, 'value') %}
sort the dict by value, case insensitive
"""
if by == "key":
Expand Down

0 comments on commit 2dd7691

Please sign in to comment.