Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #10035 -- Corrected more typos in the aggregation docs. Thanks …

…to Ivan Sagalaev for his eagle eyes.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9753 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit bf710bd005688e0d6615ec758124b0f914741b51 1 parent d55b361
Russell Keith-Magee authored

Showing 1 changed file with 3 additions and 3 deletions. Show diff stats Hide diff stats

  1. 6  docs/topics/db/aggregation.txt
6  docs/topics/db/aggregation.txt
@@ -268,14 +268,14 @@ the annotation is computed over all members of the group.
268 268
 For example, consider an author query that attempts to find out the average
269 269
 rating of books written by each author:
270 270
 
271  
-    >>> Author.objects.annotate(average_rating=Avg('book_rating'))
  271
+    >>> Author.objects.annotate(average_rating=Avg('book__rating'))
272 272
 
273 273
 This will return one result for each author in the database, annotate with
274 274
 their average book rating.
275 275
 
276 276
 However, the result will be slightly different if you use a ``values()`` clause::
277 277
 
278  
-    >>> Author.objects.values('name').annotate(average_rating=Avg('book_rating'))
  278
+    >>> Author.objects.values('name').annotate(average_rating=Avg('book__rating'))
279 279
 
280 280
 In this example, the authors will be grouped by name, so you will only get
281 281
 an annotated result for each *unique* author name. This means if you have
@@ -302,7 +302,7 @@ output.
302 302
 For example, if we reverse the order of the ``values()`` and ``annotate()``
303 303
 clause from our previous example::
304 304
 
305  
-    >>> Author.objects.annotate(average_rating=Avg('book_rating')).values('name')
  305
+    >>> Author.objects.annotate(average_rating=Avg('book__rating')).values('name')
306 306
 
307 307
 This will now yield one unique result for each author; however, only
308 308
 the author's name and the ``average_rating`` annotation will be returned

0 notes on commit bf710bd

Please sign in to comment.
Something went wrong with that request. Please try again.