Menu
×
   ❮   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

Template Filter - dictsortreversed


Example

Sort the dictionary descending by year:

{% for x in cars|dictsortreversed:"year" %}
  <p>{{ x.year }} {{ x.brand }} {{ x.model }}.</p>
{% endfor %}
Run Example »

Definition and Usage

The dictsortreversed filter sorts a dictionary by the specified field, descending.

Use the dictsort filter to sort ascending.


Syntax

{{ value|dictsortreversed:fieldname }}

Template filters are defined by using a pipe | character followed by the name of the filter.

Arguments are defined by using a colon : character followed by the argument value.


Arguments

Value Description
fieldname Required. The name of the field to be sorted on.