Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #13263 -- Corrected field name typo in queries documentation ex…

…amples. Thanks, RicherPots for bug report and gabrielhurley for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12926 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit e07570f10e0989ea23532078ab288408c34a6bc6 1 parent 7cc4046
Justin Bronn authored April 05, 2010

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

  1. 10  docs/topics/db/queries.txt
10  docs/topics/db/queries.txt
@@ -419,7 +419,7 @@ models doesn't have a value that meets the filter condition, Django will treat
419 419
 it as if there is an empty (all values are ``NULL``), but valid, object there.
420 420
 All this means is that no error will be raised. For example, in this filter::
421 421
 
422  
-    Blog.objects.filter(entry__author__name='Lennon')
  422
+    Blog.objects.filter(entry__authors__name='Lennon')
423 423
 
424 424
 (if there was a related ``Author`` model), if there was no ``author``
425 425
 associated with an entry, it would be treated as if there was also no ``name``
@@ -427,14 +427,14 @@ attached, rather than raising an error because of the missing ``author``.
427 427
 Usually this is exactly what you want to have happen. The only case where it
428 428
 might be confusing is if you are using ``isnull``. Thus::
429 429
 
430  
-    Blog.objects.filter(entry__author__name__isnull=True)
  430
+    Blog.objects.filter(entry__authors__name__isnull=True)
431 431
 
432 432
 will return ``Blog`` objects that have an empty ``name`` on the ``author`` and
433 433
 also those which have an empty ``author`` on the ``entry``. If you don't want
434 434
 those latter objects, you could write::
435 435
 
436  
-    Blog.objects.filter(entry__author__isnull=False,
437  
-            entry__author__name__isnull=True)
  436
+    Blog.objects.filter(entry__authors__isnull=False,
  437
+            entry__authors__name__isnull=True)
438 438
 
439 439
 Spanning multi-valued relationships
440 440
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -532,7 +532,7 @@ any joins needed to access the related object. For example, to retrieve all
532 532
 the entries where the author's name is the same as the blog name, we could
533 533
 issue the query:
534 534
 
535  
-    >>> Entry.objects.filter(author__name=F('blog__name'))
  535
+    >>> Entry.objects.filter(authors__name=F('blog__name'))
536 536
 
537 537
 The pk lookup shortcut
538 538
 ----------------------

0 notes on commit e07570f

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