1👍
You can use annotations for this.
from django.db.models import Count
Party.objects.filter(
participants__has_iphone=True
).annotate(iphone_count=Count('participants')).filter(
iphone_count=4
)
Source:stackexchange.com
1👍
You can use annotations for this.
from django.db.models import Count
Party.objects.filter(
participants__has_iphone=True
).annotate(iphone_count=Count('participants')).filter(
iphone_count=4
)