Opened 18 years ago

Closed 18 years ago

#3261 closed defect (worksforme)

Missing imports in example.

Reported by: dave.pawson@… Owned by: Jacob
Component: Documentation Version:
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

http://www.djangoproject.com/documentation/tutorial1/

Has

# Create a new Poll.

from datetime import datetime
p = Poll(question="What's up?", pub_date=datetime.now())

Neither time nor datetime are imported.
I think it should be corrected.

Also the id values are returned as longs.

regards

Change History (1)

comment:1 by ramiro <rm0 _at_ gmx.net>, 18 years ago

Resolution: worksforme
Status: newclosed

Just tried the entire interactive session just to be sure, it works flawlessly here.

Note the

>>> from datetime import datetime

line, it is importing the datetime class from the datetime module.

# 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())

Regards,

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