[Django]-Can't compare datetime.datetime to builtin_function_or_method

6👍

datetime.date.today is not calling the function you think it is:

>>> import datetime
>>> datetime.date.today
<built-in method today of type object at 0x7fb681a90f80>  # NOT CALLING FUNCTION

>>> datetime.date.today()  # You need () at the end
datetime.date(2015, 11, 4) 

If you add the parentheses, you’ll get the result you expect.

👤TayTay

Leave a comment