1👍
I found it out.
from django.db.models import Count, Case, When, IntegerField
queryset.annotate(parts_overlap=Count(
Case(
When(parts__in=list, then=1),
output_field=IntegerField()
)
))
Source:stackexchange.com
1👍
I found it out.
from django.db.models import Count, Case, When, IntegerField
queryset.annotate(parts_overlap=Count(
Case(
When(parts__in=list, then=1),
output_field=IntegerField()
)
))