Opened 17 years ago

Closed 17 years ago

#6680 closed (invalid)

Error in 0.96 tutorial 1 documentation

Reported by: Colin Humber Owned by: nobody
Component: Documentation Version: 0.96
Severity: Keywords: Tutorial
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The line within the Poll.was_published_today(self) function does not work:

return self.pub_date.date() == datetime.date.today()

The python shell complains that datetime.date object has no attribute 'date'. When I change the line to:
return self.pub_date == datetime.date.today()

it works fine.

Change History (1)

comment:1 by Malcolm Tredinnick, 17 years ago

Resolution: invalid
Status: newclosed

pub_date should be a DateTimeField. It looks like you may have made it a DateField instead. A DateTimeField will mean the Python attribute should be a datetime.datetime}} object, which does have a {{{date() method.

Check your models (and database) carefully and, if you're still having troubles, post your models to the django-users list with an explanation of what's going wrong. I just worked through the tutorial quickly up to that point and it worked fine for me, so I suspect there's a typo on your end.

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