django-bs

Bootstrap integration for django using widget templates
git clone https://git.ce9e.org/django-bs.git

commit
c2a4a59d7376d84d98ae5809516f138bae9ee073
parent
60aa1cc9444ab9e64f93eaef8e241b389d492ebf
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-04-18 19:44
use widget.use_fieldset if available

New in Django 4.1.

https://docs.djangoproject.com/en/4.1/ref/forms/widgets/#django.forms.Widget.use_fieldset

Diffstat

M django_bs/templates/django/forms/widgets/multiwidget.html 4 ++--
M django_bs/templatetags/bootstrap.py 2 +-

2 files changed, 3 insertions, 3 deletions


diff --git a/django_bs/templates/django/forms/widgets/multiwidget.html b/django_bs/templates/django/forms/widgets/multiwidget.html

@@ -1,7 +1,7 @@
    1    -1 <fieldset class="row g-3">
   -1     1 <div class="row g-3">
    2     2     {% for widget in widget.subwidgets %}
    3     3         <div class="col-sm">
    4     4             {% include widget.template_name %}
    5     5         </div>
    6     6     {% endfor %}
    7    -1 </fieldset>
   -1     7 </div>

diff --git a/django_bs/templatetags/bootstrap.py b/django_bs/templatetags/bootstrap.py

@@ -56,7 +56,7 @@ def bootstrap_field(
   56    56     return {
   57    57         'field': boundfield,
   58    58         'check': is_check and not has_options,
   59    -1         'fieldset': is_check and has_options,
   -1    59         'fieldset': getattr(widget, 'use_fieldset', is_check and has_options),
   60    60         'addon_before': addon_before,
   61    61         'addon_after': addon_after,
   62    62         'show_label': show_label,