﻿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
5059	Probably missing import in sample code	gregg	Jacob	"On the page:
http://www.djangoproject.com/documentation/tutorial01/

There is a sample code:
# Import the model classes we just wrote.
>>> from mysite.polls.models import Poll, Choice

# No polls are in the system yet.
>>> Poll.objects.all()
[]

# Create a new Poll.
>>> from datetime import datetime
>>> p = Poll(question=""What's up?"", pub_date=datetime.now())

# Save the object into the database. You have to call save() explicitly.
>>> p.save()

# Now it has an ID. Note that this might say ""1L"" instead of ""1"", depending
# on which database you're using. That's no biggie; it just means your
# database backend prefers to return integers as Python long integer
# objects.
>>> p.id
1

# Access database columns via Python attributes.
>>> p.question
""What's up?""
>>> p.pub_date
datetime.datetime(2005, 7, 15, 12, 00, 53)

# Change values by changing the attributes, then calling save().
>>> p.pub_date = datetime(2005, 4, 1, 0, 0)
>>> p.save()

# objects.all() displays all the polls in the database.
>>> Poll.objects.all()
[<Poll: Poll object>]



which throws:
Traceback (most recent call last):
  File ""<console>"", line 1, in <module>
NameError: name 'datetime' is not defined

after this line:
>>> p = Poll(question=""What's up?"", pub_date=datetime.now())"		closed	Documentation	dev		duplicate			Unreviewed	0	0	0	0	0	0
