3

Reading django-crispy-forms I noticed than:

The way you do horizontal forms in Bootstrap version 3 is setting some col-lg-X classes in labels and divs wrapping fields. This would mean a lot of hassle updating your layout objects for settings these classes, too much verbosity. Instead some FormHelper attributes have been added to help you easily achieve this.

And an example is provided:

helper.label_class = 'col-lg-2'
helper.field_class = 'col-lg-8'

My question is:

How can I change default label_class or field_class for a form field?

In bootstrap doc sample:

helper.label_class = 'col-lg-2'
helper.field_class = 'col-lg-8'
helper.layout = Layout(
    'email',            #<--- How to set class to 'col-lg-4' only for this field?
    'password',
    'remember_me',
    StrictButton('Sign in', css_class='btn-default'),
)
dani herrera
  • 48,760
  • 8
  • 117
  • 177
  • Have you tried to wrap field into a div: http://stackoverflow.com/questions/15157262/django-crispy-forms-nesting-a-formset-within-a-form ? – dani herrera Apr 12 '14 at 20:34

0 Answers0