diff options
author | Yulqen <246857+yulqen@users.noreply.github.com> | 2024-04-23 11:22:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-23 11:22:21 +0100 |
commit | ceca6fa956b21c43263e53c328d619c4ede21914 (patch) | |
tree | a48384210cdc168e3bd3ccff6d6d516eeed9e748 /templates/w3/table_inline_formset.html | |
parent | 8b084e9fe7a5f3a04c32daf9a24f7f2cf67300f9 (diff) | |
parent | 0f951dcf029d4af284467543a3afdf5bf6581a20 (diff) |
Merge pull request #22 from defencedigital/pyswitch
switched to Django
Diffstat (limited to 'templates/w3/table_inline_formset.html')
-rw-r--r-- | templates/w3/table_inline_formset.html | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/templates/w3/table_inline_formset.html b/templates/w3/table_inline_formset.html new file mode 100644 index 0000000..a4b951d --- /dev/null +++ b/templates/w3/table_inline_formset.html @@ -0,0 +1,57 @@ +{% load crispy_forms_tags %} +{% load crispy_forms_utils %} +{% load crispy_forms_field %} + +{% specialspaceless %} +{% if formset_tag %} +<form {{ flat_attrs }} method="{{ form_method }}" {% if formset.is_multipart %} enctype="multipart/form-data"{% endif %}> +{% endif %} + {% if formset_method|lower == 'post' and not disable_csrf %} + {% csrf_token %} + {% endif %} + + <div> + {{ formset.management_form|crispy }} + </div> + + <table{% if form_id %} id="{{ form_id }}_table"{% endif%} class="table table-striped table-sm"> + <thead> + {% if formset.readonly and not formset.queryset.exists %} + {% else %} + <tr> + {% for field in formset.forms.0 %} + {% if field.label and not field.is_hidden %} + <th for="{{ field.auto_id }}" class="col-form-label {% if field.field.required %}requiredField{% endif %}"> + {{ field.label }}{% if field.field.required and not field|is_checkbox %}<span class="asteriskField">*</span>{% endif %} + </th> + {% endif %} + {% endfor %} + </tr> + {% endif %} + </thead> + + <tbody> + <tr class="d-none empty-form"> + {% for field in formset.empty_form %} + {% include 'w3/field.html' with tag="td" form_show_labels=False %} + {% endfor %} + </tr> + + {% for form in formset %} + {% if form_show_errors and not form.is_extra %} + {% include "w3/errors.html" %} + {% endif %} + + <tr> + {% for field in form %} + {% include 'w3/field.html' with tag="td" form_show_labels=False %} + {% endfor %} + </tr> + {% endfor %} + </tbody> + </table> + + {% include "w3/inputs.html" %} + +{% if formset_tag %}</form>{% endif %} +{% endspecialspaceless %} |