Avoid template errors when form.cover is not defined

This commit is contained in:
Baptiste Gelez 2018-10-31 14:28:26 +01:00
parent 1a49569bf2
commit 464832bb31

View file

@ -37,9 +37,9 @@
<label for="cover">{{ "Illustration" | _ }}<small>{{ "Optional" | _ }}</small></label>
<select id="cover" name="cover">
<option value="none" {% if not form.cover %}selected{% endif %}>{{ "None" | _ }}</option>
<option value="none" {% if form is undefined or form.cover is undefined %}selected{% endif %}>{{ "None" | _ }}</option>
{% for media in medias %}
<option value="{{ media.id }}" {% if form.cover == media.id %}selected{% endif %}>
<option value="{{ media.id }}" {% if form is defined and form.cover is defined and form.cover == media.id %}selected{% endif %}>
{{ media.alt_text | default(value=media.content_warning) }}
</option>
{% endfor %}