Skip to content

Commit

Permalink
Ensure results are distinct when applying a filter, there may be n:m …
Browse files Browse the repository at this point in the history
…relations around
  • Loading branch information
matthiask committed Jan 14, 2025
1 parent b3433b3 commit 6994ba0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion feincms3_data/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ def dump_specs(specs, *, mappers=None, objects=None):
stream.write(', "objects": ')
serializer = JSONSerializer(mappers=mappers or {})
if objects is None:
objects = chain.from_iterable(_model_queryset(spec) for spec in specs)
objects = chain.from_iterable(
_model_queryset(spec).distinct() for spec in specs
)
serializer.serialize(objects, stream=stream)
stream.write("}")
return stream.getvalue()
Expand Down

0 comments on commit 6994ba0

Please sign in to comment.