Opened 9 years ago

Closed 9 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: UI/UX:

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 Changed 9 years ago by ramiro <rm0 _at_ gmx.net>

  • Resolution set to worksforme
  • Status changed from new to closed

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