db.models.Count

class Count(expression, distinct=False, **extra) [source]

Returns the number of objects that are related through the provided expression.

  • Default alias: <field>__count
  • Return type: int

Has one optional argument:

distinct

If distinct=True, the count will only include unique instances. This is the SQL equivalent of COUNT(DISTINCT <field>). The default value is False.

doc_Django
2016-10-09 18:35:15
Comments
Leave a Comment

Please login to continue.