diff options
| author | Tim Graham <timograham@gmail.com> | 2016-05-14 19:06:31 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-05-14 19:07:39 -0400 |
| commit | dbd72b850b487be37df2940d16697a2d57b73ac6 (patch) | |
| tree | 30783948c9aeb6216d5a43a3a9919b1b00af6d13 /docs/topics/db | |
| parent | 936a7df6520941e264f741766281fc00e4709a2d (diff) | |
[1.9.x] Refs #26021 -- Used hanging indentation in some doc examples.
Backport of e475e849703d937e158e75e7a6d9cb99090857f6 from master
Diffstat (limited to 'docs/topics/db')
| -rw-r--r-- | docs/topics/db/queries.txt | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/docs/topics/db/queries.txt b/docs/topics/db/queries.txt index 6d2cbd9175..0cb6b1db1f 100644 --- a/docs/topics/db/queries.txt +++ b/docs/topics/db/queries.txt @@ -519,8 +519,7 @@ will return ``Blog`` objects that have an empty ``name`` on the ``author`` and also those which have an empty ``author`` on the ``entry``. If you don't want those latter objects, you could write:: - Blog.objects.filter(entry__authors__isnull=False, - entry__authors__name__isnull=True) + Blog.objects.filter(entry__authors__isnull=False, entry__authors__name__isnull=True) Spanning multi-valued relationships ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -556,14 +555,12 @@ select all blogs that contain entries with both *"Lennon"* in the headline and that were published in 2008 (the same entry satisfying both conditions), we would write:: - Blog.objects.filter(entry__headline__contains='Lennon', - entry__pub_date__year=2008) + Blog.objects.filter(entry__headline__contains='Lennon', entry__pub_date__year=2008) To select all blogs that contain an entry with *"Lennon"* in the headline **as well as** an entry that was published in 2008, we would write:: - Blog.objects.filter(entry__headline__contains='Lennon').filter( - entry__pub_date__year=2008) + Blog.objects.filter(entry__headline__contains='Lennon').filter(entry__pub_date__year=2008) Suppose there is only one blog that had both entries containing *"Lennon"* and entries from 2008, but that none of the entries from 2008 contained *"Lennon"*. |
