Used to provide a default string when the variable evaluates to False.
Variable
inventory = {
'gloves': 0,
'hats': 51,
'scarves': 2,
'socks': 13
}
Template
<ol>
{% for item, remaining in inventory.items %}
<li>{{ item }}: {{ remaining|default:"out of stock" }}</li>
{% endfor %}
</ol>
Result
<ol> <li>gloves: out of stock</li> <li>hats: 51</li> <li>scarves: 2</li> <li>socks: 13</li> </ol>
