zostera / django-bootstrap5

Bootstrap 5 for Django

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for inline checkboxes

akifd opened this issue · comments

Currently it is not possible to render checkboxes inline as in Bootstrap documentation: https://getbootstrap.com/docs/5.1/forms/checks-radios/#inline

I would need this option in the bootstrap_field template tag.

It actually seems like this is supported, but only for the CheckboxInput, which only renders one checkbox. To render multiple checkboxes, CheckboxSelectMultiple must be used.

https://github.com/zostera/django-bootstrap5/blob/v21.3/src/django_bootstrap5/renderers.py#L504

Could the above line be changed to include CheckboxSelectMultiple, i.e. isinstance(self.widget, [CheckboxInput, CheckboxSelectMultiple])?

Actually, the relevant part of the code is here, in a template, where the classes of the containing div are 100% hard-coded.