Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit 6e030e7d1e866d02867c7bc7ddbf2c2243541472 1 parent 36e97e5
Russell Keith-Magee authored March 08, 2010

Showing 1 changed file with 12 additions and 3 deletions. Show diff stats Hide diff stats

  1. 15  docs/intro/tutorial01.txt
15  docs/intro/tutorial01.txt
@@ -656,8 +656,16 @@ Save these changes and start a new Python interactive shell by running
656 656
 
657 657
     # Give the Poll a couple of Choices. The create call constructs a new
658 658
     # choice object, does the INSERT statement, adds the choice to the set
659  
-    # of available choices and returns the new Choice object.
  659
+    # of available choices and returns the new Choice object. Django creates
  660
+    # a set to hold the "other side" of a ForeignKey relation
  661
+    # (e.g. a poll's choices) which can be accessed via the API.
660 662
     >>> p = Poll.objects.get(pk=1)
  663
+
  664
+    # Display any choices from the related object set -- none so far.
  665
+    >>> p.choice_set.all()
  666
+    []
  667
+
  668
+    # Create three choices.
661 669
     >>> p.choice_set.create(choice='Not much', votes=0)
662 670
     <Choice: Not much>
663 671
     >>> 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
685 693
     >>> c = p.choice_set.filter(choice__startswith='Just hacking')
686 694
     >>> c.delete()
687 695
 
688  
-For full details on the database API, see our :ref:`Database API reference
689  
-<topics-db-queries>`.
  696
+For more information on model relations, see :ref:`Accessing related objects
  697
+<ref-models-relations>`. For full details on the database API, see our
  698
+:ref:`Database API reference <topics-db-queries>`.
690 699
 
691 700
 When you're comfortable with the API, read :ref:`part 2 of this tutorial
692 701
 <intro-tutorial02>` to get Django's automatic admin working.

0 notes on commit 6e030e7

Please sign in to comment.
Something went wrong with that request. Please try again.