---
title: '|dictsortreversed'
description: reverse sorts a list of dictionaries by `key`.
date: '2026-08-02'
categories:
  - Filter
  - Data Structure
canonical: https://coolify.djangotemplatetagsandfilters.com/filters/dictsortreversed/
doc_link: https://docs.djangoproject.com/en/6.0/ref/templates/builtins/#dictsortreversed
---

# |dictsortreversed

reverse sorts a list of dictionaries by `key`.

## Documentation

Reverse sorts a list of dictionaries by `key`.

### Variable

```django
foods = [
    {'name': 'Apple', 'category': 'Fruit'},
    {'name': 'Banana', 'category': 'Fruit'},
    {'name': 'Corn', 'category': 'Vegetable'},
    {'name': 'Grape', 'category': 'Fruit'},
    {'name': 'Hamburger', 'category': 'Meat'},
    {'name': 'Pepper', 'category': 'Vegetable'},
]
```

### Template

```django
<ol>
  {% for food in foods|dictsortreversed:'category' %}
    <li>{{ food.name }}, {{ food.category }} </li>
  {% endfor %}
</ol>
```

### Result

```django
<ol>
    <li>Corn, Vegetable </li>
    <li>Pepper, Vegetable </li>
    <li>Hamburger, Meat </li>
    <li>Apple, Fruit </li>
    <li>Banana, Fruit </li>
    <li>Grape, Fruit </li>
</ol>
```

Notice that the list is sorted by category in reverse order.

`dictsortreversed` can also be used to sort lists of other sequences using the index of the item you wish to sort by as the argument.

See also: [dictsort](/filters/dictsort).
