          """ Check a key of `prepopulated_fields` dictionary, i.e. check that it
          is a name of existing field and the field is one of the allowed types.
          """
  
          forbidden_field_types = (
              models.DateTimeField,
              models.ForeignKey,
              models.ManyToManyField
          )
  
          try:
              field = model._meta.get_field(field_name)
          except FieldDoesNotExist:
              return refer_to_missing_field(field=field_name, option=label,
                                            model=model, obj=obj, id='admin.E027')
 
</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             if isinstance(field, forbidden_field_types):
 </s> add             if field.many_to_many or isinstance(field, (models.DateTimeField, models.ForeignKey)): </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                 "The value of 'fieldsets[1][1][\"fields\"]' cannot include the ManyToManyField "
                "'authors', because that field manually specifies a relationship model.",
 </s> add                 "The value of 'fieldsets[1][1][\"fields\"]' cannot include the many-to-many field "
                "'authors' because that field manually specifies a relationship model.", </s> remove     # avoid a circular import
    from django.db.models.fields.related import ManyToManyField
 </s> add 
          """ Check a key of `prepopulated_fields` dictionary, i.e. check that it
          is a name of existing field and the field is one of the allowed types.
          """
  






          try:
              field = model._meta.get_field(field_name)
          except FieldDoesNotExist:
              return refer_to_missing_field(field=field_name, option=label,
                                            model=model, obj=obj, id='admin.E027')
keep keep keep keep replace replace replace replace 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/contrib/admin/checks.py