                  f = self.model._meta.get_field(k)
              except FieldDoesNotExist:
                  continue
              # We have to special-case M2Ms as a list of comma-separated PKs.
              if isinstance(f, models.ManyToManyField):
                  initial[k] = initial[k].split(",")
          return initial
  
      @csrf_protect_m
      @transaction.atomic
 
</s> remove         if isinstance(f, ManyToManyField):
 </s> add         if f.many_to_many: </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     # avoid a circular import
    from django.db.models.fields.related import ManyToManyField
 </s> add  </s> remove         forbidden_field_types = (
            models.DateTimeField,
            models.ForeignKey,
            models.ManyToManyField
        )

 </s> add  </s> remove             elif isinstance(db_field, models.ManyToManyField):
 </s> add             elif db_field.many_to_many:
            if f.many_to_many:
                  f = self.model._meta.get_field(k)
              except FieldDoesNotExist:
                  continue
              # We have to special-case M2Ms as a list of comma-separated PKs.
            if f.many_to_many:
                  initial[k] = initial[k].split(",")
          return initial
  
      @csrf_protect_m
      @transaction.atomic
keep keep keep keep 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/contrib/admin/options.py