Found simple workaround. Just use count on the primary key column
instead:
objects_aggr = objects.values(name).annotate(count_without_null=Count
(attribute), count_with_null=Count("pk")).order_by(name)
--~--~-~--~~~---~--~~
You received this message because you are
Hey, I want to count even null values using annotate. Is there a way
to do that?
Here is what I've done:
objects_aggr = objects.values(name).annotate(value=Count
(attribute)).order_by(name)
This does exactly what I want except that it does not count null
values. To count even null values I woul
2 matches
Mail list logo