0

I am trying to filter some annotations in a ViewSetlike so:

queryset = Confirmation.objects.values('prediction__specimen_id').annotate(
    sample_id=F('target_prediction__specimen_id'),
    num_selected=Count('selected', filter=Q(selected=True)),
    num_validated=Count('validated', filter=Q(validated=True)),
    num_has_standard=Count('has_standard', filter=Q(has_standard=True)))

However, I am getting the following error:

'WhereNode' object has no attribute 'output_field'

My syntax seems to be correct according to all guides. I am running Django 2.1. Any idea what's happening? Can I not do this in Django Rest Framework because of paging?

RubyJ
  • 193
  • 2
  • 16

1 Answers1

0

Looks like syntax was indeed the issue. My answer has been edited to include the correct code. Cheers!

RubyJ
  • 193
  • 2
  • 16