I am working with a form in django with crispy form and it has many fields, and the checkboxinput field does not render well in the html, it is overlapped in the label and very big. previously i was using another template style but when i changed the html, the checks were broken
form.py
class TestForm(forms.ModelForm):
class Meta:
model = Test
fields = [
'test1',
'test2'
]
labels = {
'test1':'Test 1',
'test2':'Test 2',}
widgets = {
'test1':forms.CheckboxInput(attrs={'class':'form-check-label'}),
'test2':forms.CheckboxInput(attrs={'class':'form-check-label'}),
form.html
<div class="form-group col-md-4 d-flex align-items-center pt-4 pl-2">
</div>
<div class="form-group col-md-4 d-flex align-items-center pt-4 pl-2">
</div>
This is how the checkboxes and the labels look
Aucun commentaire:
Enregistrer un commentaire