We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 21166a3 commit 1ecbeebCopy full SHA for 1ecbeeb
rest_framework/utils/model_meta.py
@@ -76,7 +76,12 @@ def _get_forward_relationships(opts):
76
Returns an `OrderedDict` of field names to `RelationInfo`.
77
"""
78
forward_relations = OrderedDict()
79
- for field in [field for field in opts.fields if field.serialize and get_remote_field(field)]:
+ for field in [
80
+ field for field in opts.fields
81
+ if field.serialize and get_remote_field(field) and not (field.primary_key and field.one_to_one)
82
+ # If the field is a OneToOneField and it's been marked as PK, then this
83
+ # is a multi-table inheritance auto created PK ('%_ptr').
84
+ ]:
85
forward_relations[field.name] = RelationInfo(
86
model_field=field,
87
related_model=get_related_model(field),
0 commit comments