code: def add_attr2fields(self, attr_name, attr_val, fields=[], exclude=[], include_all_if_empty=True):
          
          for f in self.filter_fields(fields, exclude, include_all_if_empty):
              f = self.fields[f.name]
              org_val = f.widget.attrs.get(attr_name, '')
              f.widget.attrs[attr_name] = '%s %s' % (org_val, attr_val) if org_val else attr_val
docs: add attr to fields