Skip to content

Commit

Permalink
don't build nested keys for reverse relationships
Browse files Browse the repository at this point in the history
  • Loading branch information
sheppard committed Jan 13, 2023
1 parent 58e9a15 commit 142ffd0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions natural_keys/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ def build_natural_key_fields(self):
info = model_meta.get_field_info(self.Meta.model)
fields = OrderedDict()
for field, relation_info in info.relations.items():
if relation_info.reverse:
continue
if not issubclass(relation_info.related_model, NaturalKeyModel):
continue
field_class, field_kwargs = self.build_nested_field(
Expand Down

0 comments on commit 142ffd0

Please sign in to comment.