diff --git a/templates/fieldsets_with_inlines/fieldset.html b/templates/fieldsets_with_inlines/fieldset.html new file mode 100644 index 00000000..cf44f8ba --- /dev/null +++ b/templates/fieldsets_with_inlines/fieldset.html @@ -0,0 +1,57 @@ +{% comment %} +Local override of https://github.com/robertkovac/django-fieldsets-with-inlines/blob/master/fieldsets_with_inlines/templates/fieldsets_with_inlines/fieldset.html +Why this override exists: +- The third-party template used the removed Django filter `length_is`, which raises "Invalid filter: 'length_is'" on recent Django versions. + +Changes made in this copy: +- Replaced all `line.fields|length_is:'1'` checks with `line.fields|length == 1`. +- Migrated row/field wrappers to current Django admin layout classes and structure: `flex-container`, `form-multiline`, and `fieldBox`. +- Kept checkbox/read-only rendering behavior equivalent to upstream package behavior. +- Updated help text markup to current admin pattern, including hidden-state class and optional `id="_helptext"` for accessibility. +- Kept collapsible fieldset handling (`fieldset.is_collapsible`) and heading output. + +Goal: +- Preserve fieldsets-with-inlines behavior while restoring compatibility and visual consistency with the native Django admin layout. +{% endcomment %} +
+ {% if fieldset.name %} + {% if fieldset.is_collapsible %}
{% endif %} +

{{ fieldset.name }}

+ {% if fieldset.is_collapsible %}
{% endif %} + {% endif %} + + {% if fieldset.description %} +
{{ fieldset.description|safe }}
+ {% endif %} + + {% for line in fieldset %} +
+ {% if line.fields|length == 1 %}{{ line.errors }}{% else %}
{% endif %} + {% for field in line %} +
+ {% if not line.fields|length == 1 and not field.is_readonly %}{{ field.errors }}{% endif %} +
+ {% if field.is_checkbox %} + {{ field.field }}{{ field.label_tag }} + {% else %} + {{ field.label_tag }} + {% if field.is_readonly %} +
{{ field.contents }}
+ {% else %} + {{ field.field }} + {% endif %} + {% endif %} +
+ {% if field.field.help_text %} +
+
{{ field.field.help_text|safe }}
+
+ {% endif %} +
+ {% endfor %} + {% if not line.fields|length == 1 %}
{% endif %} +
+ {% endfor %} + + {% if fieldset.name and fieldset.is_collapsible %}
{% endif %} +