[Django]-QuerySet results being duplicated when chaining queries

3👍

If you do a query on a ManyToManyField Django will perform an INNER JOIN which means there will be a row for every item on each side of the join. If you want to have unique results use distinct().

queryset_list = queryset_list.filter(
    skills__skill_description__in=skill_filter
).distinct()

See this article for some examples.

Leave a comment