Django 4.2: Adjust instance detail template

The template for the instance detail overview uses Django template
filters to define a default value for metadata with an empty value.
This usage looks magic and does not work with Django 4.2.
It looks like this is an undocumented/unspecified behavior.
This commit changes it to use {% if %} template syntax instead of
depending on the unspcified behavior.

Closes-Bug: #2040129
Change-Id: Ida5b2a721f2657347c174e386d2e023dffd64b1b
This commit is contained in:
Akihiro Motoki 2023-10-23 15:36:49 +09:00
parent 8770753fcc
commit 5c61331ff2
1 changed files with 5 additions and 3 deletions

View File

@ -146,12 +146,14 @@
<dt>{% trans "Image" %}</dt>
<dd>{% trans "None" %}</dd>
{% endif %}
{% with default_item_value="<em>"|add:_("N/A")|add:"</em>" %}
{% for key, value in instance.metadata.items %}
<dt>{{ key }}</dt>
<dd>{{ value|default:default_item_value }}</dd>
{% if value %}
<dd>{{ value }}</dd>
{% else %}
<dd><em>{% trans "N/A" %}</em></dd>
{% endif %}
{% endfor %}
{% endwith %}
</dl>
<h4>{% trans "Volumes Attached" %}</h4>