1class MyForm(forms.Form):
2 field1 = forms.CharField(widget=forms.TextInput(attrs={'class' : 'myCSSclass'}))
3 field2 = forms.CharField(widget=forms.TextInput(attrs={'class' : 'myCSSclassX myCSSclass2'}))
4
1{% load widget_tweaks %}
2
3<div class="container">
4 <div class="col-md-6">
5 {% render_field form.field1 class+="form-control myCSSclass" placeholder="Placeholder for field1" %}
6 </div>
7 <div class="col-md-6">
8 {% render_field form.field2 class+="myCSSclassX myCSSclass2" placeholder=form.field2.label %}
9 </div>
10</div>
11