From 7fbb1bd00d8a3e9a834de83d36ebcbff15c18938 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Fri, 19 Jan 2018 08:55:29 +0100 Subject: [PATCH] Fixed #29032 -- Fixed an example of using expressions in QuerySet.values(). --- docs/ref/models/querysets.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index 068d1f877b..5064a42c9e 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -540,10 +540,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')) - - >>> Blog.objects.values('author').annotate(entries=Count('entry')) - + >>> Blog.objects.values('entry__authors', entries=Count('entry')) + + >>> Blog.objects.values('entry__authors').annotate(entries=Count('entry')) + A few subtleties that are worth mentioning: