diff options
| author | Clifford Gama <cliffygamy@gmail.com> | 2025-03-06 23:29:21 +0200 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2025-03-14 10:48:54 +0100 |
| commit | fa2adc383fea89d4b7540ba65ae72279e5d9725a (patch) | |
| tree | 0cb9849e91e7db529b9ff05e35f0bb961a69c7d7 /docs/ref | |
| parent | 91971013a1d56917338bad63aee7b831019859db (diff) | |
[5.2.x] Corrected aggregation example in docs/ref/models/querysets.txt.
Backport of 3235e76eb50be20756f82cb3bbe8e32cc586f7bb from main.
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/models/querysets.txt | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index 744d01691e..96e1ee072e 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -2804,16 +2804,16 @@ number of authors that have contributed blog entries: .. code-block:: pycon >>> from django.db.models import Count - >>> Blog.objects.aggregate(Count("entry")) - {'entry__count': 16} + >>> Blog.objects.aggregate(Count("entry__authors")) + {'entry__authors__count': 16} By using a keyword argument to specify the aggregate function, you can control the name of the aggregation value that is returned: .. code-block:: pycon - >>> Blog.objects.aggregate(number_of_entries=Count("entry")) - {'number_of_entries': 16} + >>> Blog.objects.aggregate(number_of_authors=Count("entry__authors")) + {'number_of_authors': 16} For an in-depth discussion of aggregation, see :doc:`the topic guide on Aggregation </topics/db/aggregation>`. |
