These are chat archives for allegro/ralph
i've got such query:
qs = qs.annotate( vulnerabilities_count=Count('securityscan__vulnerabilities') )
i'd like to update the query so it counts specific vuls. (vuls which has field
patch_deadline greater than today)
how can i make it with django orm?
from django.db.models.fields import CharField, Field qs = qs.annotate( vulnerabilities_count=Count( Case( When( securityscan__vulnerability__patch_deadline__gte=datetime.now(), then=1, ), output_field=CharField(), ), ) )
django.core.exceptions.FieldError: Relation fields do not support nested lookups