From e0837f2cb12de5e95e621d19b186b0da43bcdee2 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Mon, 5 Oct 2015 19:07:34 -0400 Subject: Fixed #25508 -- Modified QuerySet.__repr__() to disambiguate it from a list. --- docs/intro/tutorial02.txt | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'docs/intro/tutorial02.txt') diff --git a/docs/intro/tutorial02.txt b/docs/intro/tutorial02.txt index fbf15e8d1b..1e3c1accf7 100644 --- a/docs/intro/tutorial02.txt +++ b/docs/intro/tutorial02.txt @@ -401,7 +401,7 @@ Once you're in the shell, explore the :doc:`database API `:: # No questions are in the system yet. >>> Question.objects.all() - [] + # Create a new Question. # Support for time zones is enabled in the default settings file, so @@ -432,8 +432,7 @@ Once you're in the shell, explore the :doc:`database API `:: # objects.all() displays all the questions in the database. >>> Question.objects.all() - [] - + ]> Wait a minute. ```` is, utterly, an unhelpful representation of this object. Let's fix that by editing the ``Question`` model (in the @@ -494,14 +493,14 @@ Save these changes and start a new Python interactive shell by running # Make sure our __str__() addition worked. >>> Question.objects.all() - [] + ]> # Django provides a rich database lookup API that's entirely driven by # keyword arguments. >>> Question.objects.filter(id=1) - [] + ]> >>> Question.objects.filter(question_text__startswith='What') - [] + ]> # Get the question that was published this year. >>> from django.utils import timezone @@ -535,7 +534,7 @@ Save these changes and start a new Python interactive shell by running # Display any choices from the related object set -- none so far. >>> q.choice_set.all() - [] + # Create three choices. >>> q.choice_set.create(choice_text='Not much', votes=0) @@ -550,7 +549,7 @@ Save these changes and start a new Python interactive shell by running # And vice versa: Question objects get access to Choice objects. >>> q.choice_set.all() - [, , ] + , , ]> >>> q.choice_set.count() 3 @@ -560,7 +559,7 @@ Save these changes and start a new Python interactive shell by running # Find all Choices for any question whose pub_date is in this year # (reusing the 'current_year' variable we created above). >>> Choice.objects.filter(question__pub_date__year=current_year) - [, , ] + , , ]> # Let's delete one of the choices. Use delete() for that. >>> c = q.choice_set.filter(choice_text__startswith='Just hacking') -- cgit v1.3