Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.1.X] Fixed #13532 -- Corrected and clarified examples in F() docs.…

… Thanks to erw for the report and patch.

Backport of r13254 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@13255 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit f0774927e66f1738a2e264b982c3a2a0968465b0 1 parent c179bd5
Russell Keith-Magee authored May 14, 2010

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

  1. 13  docs/topics/db/queries.txt
13  docs/topics/db/queries.txt
@@ -512,17 +512,18 @@ than pingbacks, we construct an ``F()`` object to reference the comment count,
512 512
 and use that ``F()`` object in the query::
513 513
 
514 514
     >>> from django.db.models import F
515  
-    >>> Entry.objects.filter(n_pingbacks__lt=F('n_comments'))
  515
+    >>> Entry.objects.filter(n_comments__gt=F('n_pingbacks'))
516 516
 
517 517
 Django supports the use of addition, subtraction, multiplication,
518 518
 division and modulo arithmetic with ``F()`` objects, both with constants
519  
-and with other ``F()`` objects. To find all the blog entries with *twice* as
520  
-many comments as pingbacks, we modify the query::
  519
+and with other ``F()`` objects. To find all the blog entries with more than
  520
+*twice* as many comments as pingbacks, we modify the query::
521 521
 
522  
-    >>> Entry.objects.filter(n_pingbacks__lt=F('n_comments') * 2)
  522
+    >>> Entry.objects.filter(n_comments__gt=F('n_pingbacks') * 2)
523 523
 
524  
-To find all the entries where the sum of the pingback count and comment count
525  
-is greater than the rating of the entry, we would issue the query::
  524
+To find all the entries where the rating of the entry is less than the
  525
+sum of the pingback count and comment count, we would issue the
  526
+query::
526 527
 
527 528
     >>> Entry.objects.filter(rating__lt=F('n_comments') + F('n_pingbacks'))
528 529
 

0 notes on commit f077492

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