﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
22912	Warning about missing setup_test_environment() call in tutorial 5	cfperea@…	nobody	"Hi, I've been following the official Django tutorial and came across a possible error in the documentation using version 1.6.
In the section titled ''The Django test client'' ([https://docs.djangoproject.com/en/1.6/intro/tutorial05/#the-django-test-client]) in part 5 there is this section of code:

{{{
>>> # get a response from '/'
>>> response = client.get('/')
>>> # we should expect a 404 from that address
>>> response.status_code
404
>>> # on the other hand we should expect to find something at '/polls/'
>>> # we'll use 'reverse()' rather than a hardcoded URL
>>> from django.core.urlresolvers import reverse
>>> response = client.get(reverse('polls:index'))
>>> response.status_code
200
>>> response.content
'\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 Poll
>>> from django.utils import timezone
>>> # create a Poll and save it
>>> p = Poll(question=""Who is your favorite Beatle?"", pub_date=timezone.now())
>>> p.save()
>>> # check the response once again
>>> response = client.get('/polls/')
>>> response.content
'\n\n\n    <ul>\n    \n        <li><a href=""/polls/1/"">Who is your favorite Beatle?</a></li>\n    \n    </ul>\n\n'
>>> response.context['latest_poll_list']
[<Poll: Who is your favorite Beatle?>]
}}}

However, when I wrote this test in the console the following error occurred:

{{{
Traceback (most recent call last):
  File ""<console>"", line 1, in <module>
TypeError: 'NoneType' object is not subscriptable
}}}

I changed the line 
{{{
response.context['latest_poll_list']
}}}
to 
{{{
response.context_data['latest_poll_list']
}}} 
and it worked as intended.

I'm using Python 2.7 with Django 1.6 in a Windows 7 machine."	Cleanup/optimization	closed	Documentation	1.6	Normal	fixed			Accepted	0	0	0	0	0	0
