summaryrefslogtreecommitdiff
path: root/docs/intro
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-10-05 19:07:34 -0400
committerTim Graham <timograham@gmail.com>2015-10-06 12:38:34 -0400
commite0837f2cb12de5e95e621d19b186b0da43bcdee2 (patch)
treeea6ae0b150304ed18d93fb8c3ee3b7defbda0e26 /docs/intro
parent3543fec3b739864c52de0a116dde3b0e5e885799 (diff)
Fixed #25508 -- Modified QuerySet.__repr__() to disambiguate it from a list.
Diffstat (limited to 'docs/intro')
-rw-r--r--docs/intro/overview.txt10
-rw-r--r--docs/intro/tutorial02.txt17
-rw-r--r--docs/intro/tutorial05.txt2
3 files changed, 14 insertions, 15 deletions
diff --git a/docs/intro/overview.txt b/docs/intro/overview.txt
index 77316c2662..551310e900 100644
--- a/docs/intro/overview.txt
+++ b/docs/intro/overview.txt
@@ -73,7 +73,7 @@ necessary:
# No reporters are in the system yet.
>>> Reporter.objects.all()
- []
+ <QuerySet []>
# Create a new Reporter.
>>> r = Reporter(full_name='John Smith')
@@ -87,7 +87,7 @@ necessary:
# Now the new reporter is in the database.
>>> Reporter.objects.all()
- [<Reporter: John Smith>]
+ <QuerySet [<Reporter: John Smith>]>
# Fields are represented as attributes on the Python object.
>>> r.full_name
@@ -113,7 +113,7 @@ necessary:
# Now the article is in the database.
>>> Article.objects.all()
- [<Article: Django is cool>]
+ <QuerySet [<Article: Django is cool>]>
# Article objects get API access to related Reporter objects.
>>> r = a.reporter
@@ -122,13 +122,13 @@ necessary:
# And vice versa: Reporter objects get API access to Article objects.
>>> r.article_set.all()
- [<Article: Django is cool>]
+ <QuerySet [<Article: Django is cool>]>
# The API follows relationships as far as you need, performing efficient
# JOINs for you behind the scenes.
# This finds all articles by a reporter whose name starts with "John".
>>> Article.objects.filter(reporter__full_name__startswith='John')
- [<Article: Django is cool>]
+ <QuerySet [<Article: Django is cool>]>
# Change an object by altering its attributes and calling save().
>>> r.full_name = 'Billy Goat'
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 </topics/db/queries>`::
# No questions are in the system yet.
>>> Question.objects.all()
- []
+ <QuerySet []>
# 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 </topics/db/queries>`::
# objects.all() displays all the questions in the database.
>>> Question.objects.all()
- [<Question: Question object>]
-
+ <QuerySet [<Question: Question object>]>
Wait a minute. ``<Question: Question object>`` 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()
- [<Question: What's up?>]
+ <QuerySet [<Question: What's up?>]>
# Django provides a rich database lookup API that's entirely driven by
# keyword arguments.
>>> Question.objects.filter(id=1)
- [<Question: What's up?>]
+ <QuerySet [<Question: What's up?>]>
>>> Question.objects.filter(question_text__startswith='What')
- [<Question: What's up?>]
+ <QuerySet [<Question: What's up?>]>
# 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()
- []
+ <QuerySet []>
# 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()
- [<Choice: Not much>, <Choice: The sky>, <Choice: Just hacking again>]
+ <QuerySet [<Choice: Not much>, <Choice: The sky>, <Choice: Just hacking again>]>
>>> 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)
- [<Choice: Not much>, <Choice: The sky>, <Choice: Just hacking again>]
+ <QuerySet [<Choice: Not much>, <Choice: The sky>, <Choice: Just hacking again>]>
# Let's delete one of the choices. Use delete() for that.
>>> c = q.choice_set.filter(choice_text__startswith='Just hacking')
diff --git a/docs/intro/tutorial05.txt b/docs/intro/tutorial05.txt
index fe108d3db9..a1b594dbc2 100644
--- a/docs/intro/tutorial05.txt
+++ b/docs/intro/tutorial05.txt
@@ -383,7 +383,7 @@ With that ready, we can ask the client to do some work for us::
>>> # If the following doesn't work, you probably omitted the call to
>>> # setup_test_environment() described above
>>> response.context['latest_question_list']
- [<Question: Who is your favorite Beatle?>]
+ <QuerySet [<Question: Who is your favorite Beatle?>]>
Improving our view
------------------