From f8178f98955e7ce696783964ce7a431de6ea6df0 Mon Sep 17 00:00:00 2001 From: Christophe Henry Date: Mon, 24 Jun 2024 10:35:54 +0200 Subject: [PATCH] Render field as hidden when necessary --- dsfr/templates/dsfr/form_field_snippets/field_snippet.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dsfr/templates/dsfr/form_field_snippets/field_snippet.html b/dsfr/templates/dsfr/form_field_snippets/field_snippet.html index 79460dfd2..abe4d0cd5 100644 --- a/dsfr/templates/dsfr/form_field_snippets/field_snippet.html +++ b/dsfr/templates/dsfr/form_field_snippets/field_snippet.html @@ -1,5 +1,7 @@ {% load widget_tweaks %} -{% if field|widget_type == "checkboxinput" %} +{% if field.is_hidden %} + {{ field.as_hidden }} +{% elif field|widget_type == "checkboxinput" %} {% include "dsfr/form_field_snippets/checkbox_snippet.html" %} {% elif field|widget_type == "checkboxselectmultiple" %} {% include "dsfr/form_field_snippets/checkboxselectmultiple_snippet.html" %}