From 1ecddf3487f856996815c0dd6adb165129c1e732 Mon Sep 17 00:00:00 2001 From: Ilona Podliashanyk Date: Mon, 4 Nov 2024 14:51:29 +0100 Subject: [PATCH] Add fallback for uncrispified forms where form.attrs were not set It is not necessarily a complete and/or appropriate fallback for forms that are originally non-crispy. This is in ulikely unforeseen cases where for some reason Django widget can not be rendered as a foundation-5/field.html template without loosing some field data. To sum it up: it should be generic enough for forms that are originally non-crispy but it is not a given. So if this template is to be reused by non-crispy forms (in contrast to uncrispified forms), the rendering of forms should be properly tested. --- .../web/templates/custom_crispy_templates/_form_content.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/nav/web/templates/custom_crispy_templates/_form_content.html b/python/nav/web/templates/custom_crispy_templates/_form_content.html index c631645d99..3cc15fdd52 100644 --- a/python/nav/web/templates/custom_crispy_templates/_form_content.html +++ b/python/nav/web/templates/custom_crispy_templates/_form_content.html @@ -21,5 +21,7 @@ {% endif %} {% endblock form_fields %} {% else %} - {{ form }} + {% for field in form %} + {% show_field field %} + {% endfor %} {% endif %}