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
Personally I prefer to use this method:
def __init__(self, *args, **kwargs):
super(MyForm, self).__init__(*args, **kwargs)
self.fields['email'].widget.attrs['placeholder'] = self.fields['email'].label or 'email@address.nl'
It required more code if you don't have __init__
yet, but you don't need to specify the widget.