lundi 29 juin 2015

how to add multiple attrs in Django forms


How can I add multiple attributes to an input tag in Django ?

Example: For adding a single attribute I can use this code

email = forms.EmailField(
        widget = forms.TextInput(attrs={'placeholder': 'Email'}))

But if I want to add 'class', 'size' and 'placeholder' attributes then what is the way of doing it in django forms?


Aucun commentaire:

Enregistrer un commentaire