---
title: '|unordered_list'
description: creates an unordered HTML list from a Python list of lists.
date: '2026-08-02'
categories:
  - Filter
  - Data Structure
canonical: https://www.djangotemplatetagsandfilters.com/filters/unordered_list/
doc_link: https://docs.djangoproject.com/en/6.0/ref/templates/builtins/#unordered-list
---

# |unordered_list

creates an unordered HTML list from a Python list of lists.

## Documentation

Creates an unordered HTML list from a Python list that contains other lists, which also may contains lists, etc. You must add the outermost `<ul>` tags.

### Variable

```django
shopping = [
    'Food', [
        'Veggies', ['Tomatoes', 'Cucumbers', 'Peas'],
        'Fruit', ['Apples', 'Bananas'],
        'Meat', ['Chicken', 'Ham', 'Fish']
    ],
    'Other', ['Paper Towels', 'Napkins', 'Batteries']
]
```

### Template

```django
<ul>
  {{ shopping|unordered_list }}
</ul>
```

### Result

```django
<ul>
  	<li>Food
	<ul>
		<li>Veggies
		<ul>
			<li>Tomatoes</li>
			<li>Cucumbers</li>
			<li>Peas</li>
		</ul>
		</li>
		<li>Fruit
		<ul>
			<li>Apples</li>
			<li>Bananas</li>
		</ul>
		</li>
		<li>Meat
		<ul>
			<li>Chicken</li>
			<li>Ham</li>
			<li>Fish</li>
		</ul>
		</li>
	</ul>
	</li>
	<li>Other
	<ul>
		<li>Paper Towels</li>
		<li>Napkins</li>
		<li>Batteries</li>
	</ul>
	</li>
</ul>
```

## Commentary

In theory, this is interesting, but it requires an oddly structured Python list to work correctly. It would make more sense if it worked with a structure like this that actually implies ownership:

```django
shopping = {
    'Food': [
        {
            'Veggies': ['Tomatoes', 'Cucumbers', 'Peas']
        },
        {
            'Fruit': ['Apples', 'Bananas']
        },
        {
            'Meat': ['Chicken', 'Ham', 'Fish']
        }
    ],
    'Other': ['Paper Towels', 'Napkins', 'Batteries']
}
```
