I had a problem with the Django tutorial so I asked a question here. No-one knew the answer, but I eventually figured it out with help from Robert. Python seems to be trea
The problem in the latter snippet is with this part of your code:
return (self.pub_date() == datetime.date.today())
self.pub_date
contains a datetime.datetime
instance. It's not callable like that. For example:
>>> import datetime
>>> d = datetime.datetime.now()
>>> d()
Traceback (most recent call last):
File "", line 1, in
TypeError: 'datetime.datetime' object is not callable
>>>
If you want to compare only the date
, you should call it thus:
return (self.pub_date.date() == datetime.date.today())