Clarifies logic in file upload widget

This commit is contained in:
Mouse Reeve 2021-08-21 10:33:50 -07:00
parent d1e9a164ff
commit 053579c2a4

View file

@ -2,23 +2,30 @@
{% load utilities %}
{% if widget.is_initial %}
<p class="mb-1">
{{ widget.initial_text }}:
<a href="{{ widget.value.url }}">{{ widget.value|truncatepath:10 }}</a>
</p>
{% if not widget.required %}
<p class="mb-1">
<label class="has-text-weight-normal">
<p class="mb-1">
{{ widget.initial_text }}:
<a href="{{ widget.value.url }}">{{ widget.value|truncatepath:10 }}</a>
</p>
{% if not widget.required %}
<p class="mb-1">
<label class="has-text-weight-normal">
<input type="checkbox" name="{{ widget.checkbox_name }}" id="{{ widget.checkbox_id }}"{% if widget.attrs.disabled %} disabled{% endif %}>
{{ widget.clear_checkbox_label }}
</label>{% endif %}
</p>
<p class="mb-1">
{{ widget.input_text }}:
{% else %}
<p class="mb-1">
</label>
</p>
{% endif %}
{% endif %}
<input type="{{ widget.type }}" name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %}>
<span class="help file-cta is-hidden file-too-big">{% trans "File exceeds maximum size: 10MB" %}</span>
<p class="mb-1">
{% if widget.is_initial %}
{{ widget.input_text }}:
{% endif %}
<input type="{{ widget.type }}" name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %}>
<span class="help file-cta is-hidden file-too-big">
{% trans "File exceeds maximum size: 10MB" %}
</span>
</p>