Opened 11 years ago

Closed 11 years ago

#21764 closed Uncategorized (duplicate)

Tutorial 5 typo in example session

Reported by: Don.Morton@… Owned by: nobody
Component: Documentation Version: 1.6
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hello, I believe there is a typo in your sample code at

https://docs.djangoproject.com/en/1.6/intro/tutorial05/

Under "The Django test client" section, there is a code box of interactive stuff. The large code box is prefaced with, "With that ready, we can ask the client to do some work for us:"

and the last statement in the code box looks like:

>>> response.context['latest_poll_list']
[<Poll: Who is your favorite Beatle?>]

When I execute this, I get:

In [25]: response.context['latest_poll_list']
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/home/morton/DjangoTesting/mysite/<ipython-input-25-439e12041dea> in <module>()
----> 1 response.context['latest_poll_list']

TypeError: 'NoneType' object has no attribute '__getitem__'

When I look at the next section of the tutorial, they mention the item

response.context_data['latest_poll_list']

and when I try to look at that, rather than the suggested

response.context['latest_poll_list']

it seems to work as I would expect.

I'm just learning so maybe I'm wrong :)

Change History (1)

comment:1 by Tim Graham, 11 years ago

Resolution: duplicate
Status: newclosed

This has been reported before in #21017, but I think the text is correct as it is. Please double check you are following the instructions exactly.

Note: See TracTickets for help on using tickets.
Back to Top