{% import "bootstrap/_form.html" as bform %} {% from "_icon.html" import icon %} {% macro upload(attachment, delete="", label=true, preview=false) %} {% if label %} {{ attachment.label(class_="form-label")}} {% endif %} {% if attachment.data %}
{{ attachment.label.text }}
{% if attachment.data.id and preview %} {% endif %}
{{ icon('trash') }}
{{ attachment.label(class_="form-control") }} {{ attachment(class_="form-control", disabled=True, type="text") }}
Only one attachment is supported at a time.
{% else %} {{ attachment(class_="form-control") }} {% endif %} {{ bform.errors(attachment.errors) }} {% endmacro %}