diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2018-01-19 08:55:29 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2018-01-19 08:58:46 +0100 |
| commit | 649d5eaa8b7b224fc0eb8a3339a589288d5b10e8 (patch) | |
| tree | 184ff1769e39cdb61bb0bb8f51721ae85c48e9bc | |
| parent | de1520ec2003b32e1cc93a11fbef1e711f4c8518 (diff) | |
[1.11.x] Fixed #29032 -- Fixed an example of using expressions in QuerySet.values().
Backport of 7fbb1bd00d8a3e9a834de83d36ebcbff15c18938 from master
| -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 c1c2a249f8..1a7141b3ad 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -541,10 +541,10 @@ within the same ``values()`` clause. If you need to group by another value, add it to an earlier ``values()`` clause instead. For example:: >>> from django.db.models import Count - >>> Blog.objects.values('author', entries=Count('entry')) - <QuerySet [{'author': 1, 'entries': 20}, {'author': 1, 'entries': 13}]> - >>> Blog.objects.values('author').annotate(entries=Count('entry')) - <QuerySet [{'author': 1, 'entries': 33}]> + >>> Blog.objects.values('entry__authors', entries=Count('entry')) + <QuerySet [{'entry__authors': 1, 'entries': 20}, {'entry__authors': 1, 'entries': 13}]> + >>> Blog.objects.values('entry__authors').annotate(entries=Count('entry')) + <QuerySet [{'entry__authors': 1, 'entries': 33}]> A few subtleties that are worth mentioning: |
