Inline checkboxes with django-crispy
-
26-06-2021 - |
Question
I'm using django ModelForm
and django-crispy-forms
to create beautiful bootstrap forms.
I didn't find any way to generate inline checkboxes like the one available here.
Even using crispy FormHelper(), no way do define fields like:
Field('checkbox1', css_class="inline"),
Field('checkbox2', css_class="inline"),
Field('checkbox3', css_class="inline"),
where checkbox1
, checkbox2
and checkbox3
are defined in the model as model.BooleanField
.
Any idea?
La solution
I'm the lead developer of django-crispy-forms and all I can say is that this is not currently supported. I will try to work on a patch as soon as possible, I will keep you posted.
UPDATE 2012/9/24
django-crispy-forms 1.2.0 has been released today and includes a bootstrap.InlineCheckboxes
layout object, for rendering Django CheckboxSelectMultiple
widgets with inline checkboxes. I'm not currently planning on supporting a layout object for rendering several BooleanFields this way. That makes probably more sense as a custom personal layout object.