summaryrefslogtreecommitdiff
path: root/docs/topics/db/optimization.txt
diff options
context:
space:
mode:
authorLuke Plant <L.Plant.98@cantab.net>2011-10-14 00:12:01 +0000
committerLuke Plant <L.Plant.98@cantab.net>2011-10-14 00:12:01 +0000
commitd1e5c55258d624058a93c8cacdb1f25ae7857554 (patch)
treedca859edc2229f68b7511687aa8b333378786633 /docs/topics/db/optimization.txt
parent5109ac370928a5924887424b6d6c803038fcb691 (diff)
Fixed many more ReST indentation errors, somehow accidentally missed from [16955]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16983 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/topics/db/optimization.txt')
-rw-r--r--docs/topics/db/optimization.txt22
1 files changed, 11 insertions, 11 deletions
diff --git a/docs/topics/db/optimization.txt b/docs/topics/db/optimization.txt
index dda7e9504a..baea968fdb 100644
--- a/docs/topics/db/optimization.txt
+++ b/docs/topics/db/optimization.txt
@@ -224,21 +224,21 @@ many-to-many relation to User, the following template code is optimal:
It is optimal because:
- 1. Since QuerySets are lazy, this does no database queries if 'display_inbox'
- is False.
+1. Since QuerySets are lazy, this does no database queries if 'display_inbox'
+ is False.
- #. Use of :ttag:`with` means that we store ``user.emails.all`` in a variable
- for later use, allowing its cache to be re-used.
+#. Use of :ttag:`with` means that we store ``user.emails.all`` in a variable
+ for later use, allowing its cache to be re-used.
- #. The line ``{% if emails %}`` causes ``QuerySet.__nonzero__()`` to be called,
- which causes the ``user.emails.all()`` query to be run on the database, and
- at the least the first line to be turned into an ORM object. If there aren't
- any results, it will return False, otherwise True.
+#. The line ``{% if emails %}`` causes ``QuerySet.__nonzero__()`` to be called,
+ which causes the ``user.emails.all()`` query to be run on the database, and
+ at the least the first line to be turned into an ORM object. If there aren't
+ any results, it will return False, otherwise True.
- #. The use of ``{{ emails|length }}`` calls ``QuerySet.__len__()``, filling
- out the rest of the cache without doing another query.
+#. The use of ``{{ emails|length }}`` calls ``QuerySet.__len__()``, filling
+ out the rest of the cache without doing another query.
- #. The :ttag:`for` loop iterates over the already filled cache.
+#. The :ttag:`for` loop iterates over the already filled cache.
In total, this code does either one or zero database queries. The only
deliberate optimization performed is the use of the :ttag:`with` tag. Using