mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Fixed a couple of bugs in the docs.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@39 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
26c6566215
commit
5fc13947fc
@ -197,7 +197,7 @@ For example, using the Poll and Choice models from above, if you do the followin
|
|||||||
Then subsequent calls to ``c.get_poll()`` won't hit the database.
|
Then subsequent calls to ``c.get_poll()`` won't hit the database.
|
||||||
|
|
||||||
Note that ``select_related`` follows foreign keys as far as possible. If you have the
|
Note that ``select_related`` follows foreign keys as far as possible. If you have the
|
||||||
following models...
|
following models::
|
||||||
|
|
||||||
class Poll(meta.Model):
|
class Poll(meta.Model):
|
||||||
...
|
...
|
||||||
@ -214,8 +214,8 @@ following models...
|
|||||||
...
|
...
|
||||||
)
|
)
|
||||||
|
|
||||||
...then a call to ``singlevotes.get_object(id__exact=4, select_related=True)`` will
|
then a call to ``singlevotes.get_object(id__exact=4, select_related=True)`` will
|
||||||
cache the related choice *and* the related poll.
|
cache the related choice *and* the related poll::
|
||||||
|
|
||||||
>>> sv = singlevotes.get_object(id__exact=4, select_related=True)
|
>>> sv = singlevotes.get_object(id__exact=4, select_related=True)
|
||||||
>>> c = sv.get_choice() # Doesn't hit the database.
|
>>> c = sv.get_choice() # Doesn't hit the database.
|
||||||
@ -290,3 +290,4 @@ For example::
|
|||||||
Creating new objects
|
Creating new objects
|
||||||
====================
|
====================
|
||||||
|
|
||||||
|
...
|
Loading…
Reference in New Issue
Block a user