diff --git a/rest_framework/utils/model_meta.py b/rest_framework/utils/model_meta.py index 8eb00e4334..c1c0f61f04 100644 --- a/rest_framework/utils/model_meta.py +++ b/rest_framework/utils/model_meta.py @@ -92,7 +92,7 @@ def _get_fields(opts): def _get_to_field(field): - return field.to_fields[0] if field.to_fields else None + return field.to_fields[0] if hasattr(field, 'to_fields') else None def _get_forward_relationships(opts):