dkoug Blog

django iterate form fields

Django -- Posted on Sept. 12, 2017

django iterate form fields

1
2
3
4
5
6
class FormMixin(object):

    def __init__(self, *args, **kwargs):
        super(FormMixin, self).__init__(*args, **kwargs)
        for field in self.fields:
            self.fields[field].widget.attrs['class'] = 'form-control'