          except FieldDoesNotExist:
              return refer_to_missing_field(field=field_name, option=label,
                                            model=model, obj=obj, id='admin.E027')
          else:
              if isinstance(field, forbidden_field_types):
                  return [
                      checks.Error(
                          "The value of '%s' refers to '%s', which must not be a DateTimeField, "
                          "ForeignKey or ManyToManyField." % (label, field_name),
                          obj=obj.__class__,
 
</s> remove                         "ForeignKey or ManyToManyField." % (label, field_name),
 </s> add                         "a foreign key, or a many-to-many field." % (label, field_name), </s> remove             if not isinstance(field, (models.ForeignKey, models.ManyToManyField)):
                return must_be('a ForeignKey or ManyToManyField',
 </s> add             if not field.many_to_many and not isinstance(field, models.ForeignKey):
                return must_be('a foreign key or a many-to-many field', </s> remove             if not isinstance(field, models.ManyToManyField):
                return must_be('a ManyToManyField', option=label, obj=obj, id='admin.E020')
 </s> add             if not field.many_to_many:
                return must_be('a many-to-many field', option=label, obj=obj, id='admin.E020') </s> remove                             "The value of '%s' cannot include the ManyToManyField '%s', "
 </s> add                             "The value of '%s' cannot include the many-to-many field '%s' " </s> remove                         "The value of '%s' must not be a ManyToManyField." % label,
 </s> add                         "The value of '%s' must not be a many-to-many field." % label,
            if field.many_to_many or isinstance(field, (models.DateTimeField, models.ForeignKey)):
          except FieldDoesNotExist:
              return refer_to_missing_field(field=field_name, option=label,
                                            model=model, obj=obj, id='admin.E027')
          else:
            if field.many_to_many or isinstance(field, (models.DateTimeField, models.ForeignKey)):
                  return [
                      checks.Error(
                          "The value of '%s' refers to '%s', which must not be a DateTimeField, "
                          "ForeignKey or ManyToManyField." % (label, field_name),
                          obj=obj.__class__,
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/checks.py