The 'attrs' argument to the Widget class used with each particular
Field (the Widget is what actually renders the HTML) accepts a
dictionary which will become HTML attribute names and values. For
example:
username = forms.CharField(widget=forms.TextInput(attrs={'class': 'myclass'}))
will become:
the old forms default of having class attributes for each
input type (e.g. class=vTextField for type=text)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment