      ``exclude`` is an optional list of field names. If provided, the named
      fields will be excluded from the returned dict, even if they are listed in
      the ``fields`` argument.
      """
      # avoid a circular import
      from django.db.models.fields.related import ManyToManyField
      opts = instance._meta
      data = {}
      for f in chain(opts.concrete_fields, opts.virtual_fields, opts.many_to_many):
          if not getattr(f, 'editable', False):
              continue
 
</s> remove         if isinstance(f, ManyToManyField):
 </s> add         if f.many_to_many: </s> remove   ``ManyToManyField`` ``<field name>``, because that field manually specifies a
 </s> add   many-to-many field ``<field name>``, because that field manually specifies a </s> remove             return isinstance(f, Field) and not isinstance(f, related.ManyToManyField)
 </s> add             return isinstance(f, Field) and not f.many_to_many </s> remove             elif isinstance(db_field, models.ManyToManyField):
 </s> add             elif db_field.many_to_many: </s> remove                 if (isinstance(field, models.ManyToManyField) and
                        not field.remote_field.through._meta.auto_created):
 </s> add                 if field.many_to_many and not field.remote_field.through._meta.auto_created:
      ``exclude`` is an optional list of field names. If provided, the named
      fields will be excluded from the returned dict, even if they are listed in
      the ``fields`` argument.
      """


      opts = instance._meta
      data = {}
      for f in chain(opts.concrete_fields, opts.virtual_fields, opts.many_to_many):
          if not getattr(f, 'editable', False):
              continue
keep keep keep keep replace replace keep keep keep keep keep
 Refs #24227 -- Replaced M2M isinstance checks by field.many_to_many

Thanks Markus Holtermann, Collin Anderson and Tim Graham for the reviews. 
django/forms/models.py