summaryrefslogtreecommitdiff
path: root/docs/intro/tutorial05.txt
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-08-22 19:22:04 -0400
committerTim Graham <timograham@gmail.com>2016-08-24 09:11:50 -0400
commitcf2cd4053fe3eed50ab2b7269ed72d25712c970a (patch)
tree5f9c8471ccec4f8576113968d24e23eb5c7063b0 /docs/intro/tutorial05.txt
parentb40d24960c43091f792dd711e6a5ca7a708b12ad (diff)
Fixed #27104 -- Corrected shell example in tutorial 5.
Diffstat (limited to 'docs/intro/tutorial05.txt')
-rw-r--r--docs/intro/tutorial05.txt20
1 files changed, 5 insertions, 15 deletions
diff --git a/docs/intro/tutorial05.txt b/docs/intro/tutorial05.txt
index 3f56166ed4..438cb20045 100644
--- a/docs/intro/tutorial05.txt
+++ b/docs/intro/tutorial05.txt
@@ -343,7 +343,9 @@ which will allow us to examine some additional attributes on responses such as
``response.context`` that otherwise wouldn't be available. Note that this
method *does not* setup a test database, so the following will be run against
the existing database and the output may differ slightly depending on what
-questions you already created.
+questions you already created. You might get unexpected results if your
+``TIME_ZONE`` in ``settings.py`` isn't correct. If you don't remember setting
+it earlier, check it before continuing.
Next we need to import the test client class (later in ``tests.py`` we will use
the :class:`django.test.TestCase` class, which comes with its own client, so
@@ -367,23 +369,11 @@ With that ready, we can ask the client to do some work for us::
>>> response.status_code
200
>>> response.content
- b'\n\n\n <p>No polls are available.</p>\n\n'
- >>> # note - you might get unexpected results if your ``TIME_ZONE``
- >>> # in ``settings.py`` is not correct. If you need to change it,
- >>> # you will also need to restart your shell session
- >>> from polls.models import Question
- >>> from django.utils import timezone
- >>> # create a Question and save it
- >>> q = Question(question_text="Who is your favorite Beatle?", pub_date=timezone.now())
- >>> q.save()
- >>> # check the response once again
- >>> response = client.get('/polls/')
- >>> response.content
- b'\n\n\n <ul>\n \n <li><a href="/polls/1/">Who is your favorite Beatle?</a></li>\n \n </ul>\n\n'
+ b'\n <ul>\n \n <li><a href="/polls/1/">What&#39;s up?</a></li>\n \n </ul>\n\n'
>>> # If the following doesn't work, you probably omitted the call to
>>> # setup_test_environment() described above
>>> response.context['latest_question_list']
- <QuerySet [<Question: Who is your favorite Beatle?>]>
+ <QuerySet [<Question: What's up?>]>
Improving our view
------------------