I'd like to make a mixin to set the placeholder text in the widget attrs.
Would the following be the recommended way to do it? Just adding a class variable to the Form class?
class PlaceHolderMixin(object):
placeholders = {}
def __init__(self, *args, **kwargs):
super(PlaceHolderMixin, self).__init__(*args, **kwargs)
for field_name, field in self.fields.items():
if field_name not in self.placeholders:
continue
self.fields[field_name].widget.attrs['placeholder'] = self.placeholders[field_name]