[Answered ]-Duplicate results of `ManyToManyField` when using 'through'

2👍

You need to use .distinct(). From the docs:

By default, a QuerySet will not eliminate duplicate rows. In practice, this is rarely a problem, because simple queries such as Blog.objects.all() don’t introduce the possibility of duplicate result rows. However, if your query spans multiple tables, it’s possible to get duplicate results when a QuerySet is evaluated. That’s when you’d use distinct().

Leave a comment