diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-03-08 03:20:29 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-03-08 03:20:29 +0000 |
| commit | 6e030e7d1e866d02867c7bc7ddbf2c2243541472 (patch) | |
| tree | 5a8999bce9680259e16bf40a8193ec5d419fa88f /docs/intro/tutorial01.txt | |
| parent | 36e97e59cdba6fd7895377613a1b8c1f70bf8cdb (diff) | |
Fixed #12114 -- Clarified the existence of the reverse relation _set in the tutorial. Thanks to panfist for the suggestion, and dwillis for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12711 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/intro/tutorial01.txt')
| -rw-r--r-- | docs/intro/tutorial01.txt | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/docs/intro/tutorial01.txt b/docs/intro/tutorial01.txt index df9dac6a26..c38fa7d7f5 100644 --- a/docs/intro/tutorial01.txt +++ b/docs/intro/tutorial01.txt @@ -656,8 +656,16 @@ Save these changes and start a new Python interactive shell by running # Give the Poll a couple of Choices. The create call constructs a new # choice object, does the INSERT statement, adds the choice to the set - # of available choices and returns the new Choice object. + # of available choices and returns the new Choice object. Django creates + # a set to hold the "other side" of a ForeignKey relation + # (e.g. a poll's choices) which can be accessed via the API. >>> p = Poll.objects.get(pk=1) + + # Display any choices from the related object set -- none so far. + >>> p.choice_set.all() + [] + + # Create three choices. >>> p.choice_set.create(choice='Not much', votes=0) <Choice: Not much> >>> p.choice_set.create(choice='The sky', votes=0) @@ -685,8 +693,9 @@ Save these changes and start a new Python interactive shell by running >>> c = p.choice_set.filter(choice__startswith='Just hacking') >>> c.delete() -For full details on the database API, see our :ref:`Database API reference -<topics-db-queries>`. +For more information on model relations, see :ref:`Accessing related objects +<ref-models-relations>`. For full details on the database API, see our +:ref:`Database API reference <topics-db-queries>`. When you're comfortable with the API, read :ref:`part 2 of this tutorial <intro-tutorial02>` to get Django's automatic admin working. |
