diff --git a/django/contrib/admin/views/doc.py b/django/contrib/admin/views/doc.py index 166ecdff2dd..e4d0f1c6488 100644 --- a/django/contrib/admin/views/doc.py +++ b/django/contrib/admin/views/doc.py @@ -288,9 +288,9 @@ DATA_TYPE_MAPPING = { def get_readable_field_data_type(field): # ForeignKey is a special case. Use the field type of the relation. - if field.__class__.__name__ == 'ForeignKey': + if field.get_internal_type() == 'ForeignKey': field = field.rel.get_related_field() - return DATA_TYPE_MAPPING[field.__class__.__name__] % field.__dict__ + return DATA_TYPE_MAPPING[field.get_internal_type()] % field.__dict__ def extract_views_from_urlpatterns(urlpatterns, base=''): """