Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django field tag label class

Is there a way to apply a class in a form to a {{ field.label_tag }}

I'm using twitter bootstrap and want to add a class to the label tag that field.label_tag

Hopefully there is a way to handle this. I'm using django widget tweaks to do this for the other half of the form for entering the information. Just hoping there is something I've missed that will make it this part just as easy.

like image 951
bDreadz Avatar asked Nov 01 '12 23:11

bDreadz


1 Answers

Have you tried manually creating the label element, like so:

<label class="your-class" for="{{ field.auto_id }}">{{ field.label }}</label>

Reference: Looping over Form Fields

like image 156
Dan LaManna Avatar answered Nov 15 '22 08:11

Dan LaManna