I have a django model that I\'m displaying as a form using a ModelForm. The defaults work very well for me for the most part.
However, I would like my html
See the documentation
class AuthorForm(ModelForm):
class Meta:
model = Author
widgets = {
'name': TextInput(attrs={'placeholder': 'name'}),
}
You could always create your own widget that derives from TextInput and includes the placeholder attribute, and use the widgets dictionary to simply map fields to your new widget without specifying the placeholder attribute for every field.