summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2018-01-29 10:12:58 -0500
committerTim Graham <timograham@gmail.com>2018-01-29 11:11:43 -0500
commite6f0e324e28bc7d0c125415de871466aa1f4b983 (patch)
tree4c3683809889a257c881886180998a8f286a7f3f /docs
parentc2b969e124f65d375aac969f253279085b6f7078 (diff)
Fixed #29081 -- Clarified comments in QuerySet.select_related() example.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/models/querysets.txt4
1 files changed, 3 insertions, 1 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt
index 10251efc72..c3395e9c9a 100644
--- a/docs/ref/models/querysets.txt
+++ b/docs/ref/models/querysets.txt
@@ -935,11 +935,13 @@ following models::
... then a call to ``Book.objects.select_related('author__hometown').get(id=4)``
will cache the related ``Person`` *and* the related ``City``::
+ # Hits the database with joins to the author and hometown tables.
b = Book.objects.select_related('author__hometown').get(id=4)
p = b.author # Doesn't hit the database.
c = p.hometown # Doesn't hit the database.
- b = Book.objects.get(id=4) # No select_related() in this example.
+ # Without select_related()...
+ b = Book.objects.get(id=4) # Hits the database.
p = b.author # Hits the database.
c = p.hometown # Hits the database.