Closed marc-gist closed 8 months ago
You also need to set your label and field classes, such as:
from crispy_forms.helper import FormHelper
class ExampleForm(forms.Form):
name = forms.CharField()
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper(self)
self.helper.form_class = "form-horizontal"
self.helper.label_class = "col-md-3"
self.helper.field_class = "col-md-9"
That did it... did i miss something in the docs? sorry if so!
Glad you found a solution.
I saw this in the doc, if you think it could be improved I'd appreciate thoughts!
Glad you found a solution.
I saw this in the doc, if you think it could be improved I'd appreciate thoughts!
Thanks, I see where I got confused, as those doc's reference Bootstrap3: 'The way you do horizontal forms in Bootstrap version 3 is setting some col-lg-X classes in labels'
I can not for the life of me figure out how to get crispy forms to render forms in this manner for bootstrap 5.
https://getbootstrap.com/docs/5.0/forms/layout/#horizontal-form-label-sizing
How do we do this? [edit] i do see in the code that i still need to set 'form-horizontal' which have done, but doesn't work.
Thank you!