[Answer]-Django queries based on amount of many to many relationships

1👍

You can do this with aggregation.

from django.db.models import Count
people = Person.objects.all().annotate(film_count=Count('film')).filter(film_count__gte=10)

Leave a comment