[Answered ]-Compare datetime with DateField for equivalency?

2👍

You are comparing a datetime to a date. These will never be equal. Try calling the date method on your datetime to compare it to the DateField in django, or alternatively, switch your model to use a DateTimeField.

dt.datetime.strptime('2000', '%Y').date() == myRecalledDbObj.dateFieldVal

Leave a comment