From b775ef242f6c6c92aa95227c311129e39fe01c6c Mon Sep 17 00:00:00 2001 From: JimiRecard <58371938+JimiRecard@users.noreply.github.com> Date: Mon, 6 Jun 2022 15:53:16 -0300 Subject: [PATCH] Fix table formset checkbox (#107) * Remove empty divs for checkboxes when rendering table_inline_formsets * Fix tests accordingly --- crispy_bootstrap5/templates/bootstrap5/field.html | 4 ++-- tests/results/test_tabular_formset_layout.html | 8 -------- .../test_tabular_formset_layout_failing.html | 14 +++++--------- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/crispy_bootstrap5/templates/bootstrap5/field.html b/crispy_bootstrap5/templates/bootstrap5/field.html index 142df08..538b8d5 100644 --- a/crispy_bootstrap5/templates/bootstrap5/field.html +++ b/crispy_bootstrap5/templates/bootstrap5/field.html @@ -3,7 +3,7 @@ {% if field.is_hidden %} {{ field }} {% else %} - {% if field|is_checkbox %} + {% if field|is_checkbox and tag != "td" %}
{% if label_class %}
@@ -60,7 +60,7 @@ {% endif %} {% endif %} - {% if field|is_checkbox %} + {% if field|is_checkbox and tag != "td" %} {% if label_class %}
{% endif %} diff --git a/tests/results/test_tabular_formset_layout.html b/tests/results/test_tabular_formset_layout.html index 510e90a..db7c234 100644 --- a/tests/results/test_tabular_formset_layout.html +++ b/tests/results/test_tabular_formset_layout.html @@ -23,11 +23,9 @@ -
-
Insert your email @@ -47,10 +45,8 @@ class="timeinput form-control" id="id_form-__prefix__-datetime_field_1"> -
-
Insert your email @@ -67,10 +63,8 @@ name="form-0-datetime_field_1" class="timeinput form-control" id="id_form-0-datetime_field_1"> -
-
Insert your email @@ -87,10 +81,8 @@ name="form-1-datetime_field_1" class="timeinput form-control" id="id_form-1-datetime_field_1"> -
-
Insert your email diff --git a/tests/results/test_tabular_formset_layout_failing.html b/tests/results/test_tabular_formset_layout_failing.html index ec9a10d..9ce5001 100644 --- a/tests/results/test_tabular_formset_layout_failing.html +++ b/tests/results/test_tabular_formset_layout_failing.html @@ -23,11 +23,9 @@ -
- -
+
-
- -
+