{% comment %} Shared field renderer for every record form in the app: one label-above-input block per field instead of a row. Include inside a `.form-stack` wrapper (form_generic.html does this already); pass `form=`. Extra bespoke fields (e.g. a gallery file input tacked on next to a ModelForm) can follow this include as sibling `.form-field` divs inside the same `.form-stack`. The form's media (`{{ form.media }}`) is rendered here, so a widget's own assets - an autocomplete's axios, the rich text editor's Quill - arrive with the form and a page never has to remember them. It renders nothing for a form whose widgets need no assets, which is most of them. (Don't also render `{{ form.media }}` in the page: the scripts would load twice.) Row grouping: a form may name groups of fields that share one row on medium and large screens - `field_rows = (('dosage', 'form'),)` on the form class, see the `field_rows` filter in wise_core/templatetags/wise_tags.py; every other field keeps a row of its own. On a phone every field is a row again. {% endcomment %} {% load wise_icons wise_tags %} {{ form.media }} {% for hidden in form.hidden_fields %}{{ hidden }}{% endfor %} {% if form.non_field_errors %}
{% status_glyph "negative" size=18 cls="mt-0.5" %}
{% for error in form.non_field_errors %}
{{ error }}
{% endfor %}
{% endif %} {% for row in form|field_rows %} {% if row|length > 1 %}
{% endif %} {% for field in row %} {% if field.field.widget.input_type == 'checkbox' %}
{% if field.help_text %}{{ field.help_text|safe }}{% endif %} {% if field.errors %}
    {% for error in field.errors %}
  • {{ error }}
  • {% endfor %}
{% endif %}
{% else %}
{{ field }} {% if field.help_text %}{{ field.help_text|safe }}{% endif %} {% if field.errors %}
    {% for error in field.errors %}
  • {{ error }}
  • {% endfor %}
{% endif %}
{% endif %} {% endfor %} {% if row|length > 1 %}
{% endif %} {% endfor %}