Tushar Patil
Tushar Patil

Reputation: 1479

Remove Label from django crispy form layout

I am using djano Crispy form and twitter bootstrap, i have a form.

def __init__(self, *args, **kwargs):
    self.helper = FormHelper()
    self.helper.form_method = 'POST'
    self.helper.form_class = 'form-horizontal'
    self.helper.layout = Layout( 
        Div(
            Div(HTML("""<label> Trust Admin Name</label>"""), css_class='span3'),
            Div('first_name', css_class='span3'),
            Div('middle_name', css_class='span3'),
            Div('last_name', css_class='span3'),
            ),
        )

How to remove the label first_name, middle_name and last_name from layout.

Upvotes: 1

Views: 2745

Answers (1)

thumper
thumper

Reputation: 423

http://django-crispy-forms.readthedocs.org/en/latest/form_helper.html#helper-attributes-you-can-set

Given that this is a bootstrap view, you can do:

self.helper.form_show_labels = False

Upvotes: 1

Related Questions