From 53065c9ba6e4f57a293123b4c8cf02d7a804e1e5 Mon Sep 17 00:00:00 2001 From: Valentin Deniaud Date: Wed, 4 Jan 2023 15:21:19 +0100 Subject: [PATCH] templates: add class to hide form widget (#72973) --- gadjo/static/css/_forms.scss | 4 ++++ gadjo/templates/gadjo/widget.html | 1 + 2 files changed, 5 insertions(+) diff --git a/gadjo/static/css/_forms.scss b/gadjo/static/css/_forms.scss index 7a5dc4a..f4fc725 100644 --- a/gadjo/static/css/_forms.scss +++ b/gadjo/static/css/_forms.scss @@ -33,6 +33,10 @@ form div.widget { margin-bottom: 1.5em; } +form div.widget.hidden { + display: none; +} + div.errornotice p { margin: 1ex 0; &:first-child { diff --git a/gadjo/templates/gadjo/widget.html b/gadjo/templates/gadjo/widget.html index 505b1d7..ff4b2cc 100644 --- a/gadjo/templates/gadjo/widget.html +++ b/gadjo/templates/gadjo/widget.html @@ -3,6 +3,7 @@ {{ field.css_classes }} django-{{ field|field_class_name }} {% if field.errors %}widget-with-error{% endif %} + {% if field.field.hidden %}hidden{% endif %} {% if field.field.required %}widget-required{% else %}widget-optional{% endif %}" id="{{field.id_for_label}}_p"> {% block widget-title %} -- 2.35.1