There is such a request:
stats = CompletedTask.objects.filter( Q(created_date__gt=serializer.data['begin_date']) & Q(created_date__lt=serializer.data['end_date']) ).values(shift_type_id=F('task__shift__type__id')).annotate( count=Count('task__shift__type__id') )
I get the data in this form:
[ { "shift_type_id": 4, "count": 2 }, { "shift_type_id": 5, "count": 1 } ]
What are the ways to obtain data in this form:
{4: 2, 5: 1}