MCPcopy
hub / github.com/django/django / get_count

Method get_count

django/db/models/sql/query.py:651–656  ·  view source on GitHub ↗

Perform a COUNT() query using the current filter constraints.

(self, using)

Source from the content-addressed store, hash-verified

649 return dict(zip(outer_query.annotation_select, result))
650
651 def get_count(self, using):
652 """
653 Perform a COUNT() query using the current filter constraints.
654 """
655 obj = self.clone()
656 return obj.get_aggregation(using, {"__count": Count("*")})["__count"]
657
658 def has_filters(self):
659 return self.where

Callers 1

countMethod · 0.80

Calls 3

cloneMethod · 0.95
CountClass · 0.90
get_aggregationMethod · 0.80

Tested by

no test coverage detected