﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
31994	Error in Tutorial 2	Agorar101	nobody	"The following function produces an error in the Tutorial 2. It can be problematic for new users that are getting acquainted with Django and do not know how to fix this issue.
{{{
class Question(models.Model):
    # ...
    def was_published_recently(self):
        return self.pub_date >= timezone.now() - datetime.timedelta(days=1)
}}}
returns the following error:

TypeError: can't compare datetime.datetime to datetime.date

It is easily fixed invoking the date method from now in the following way.
{{{
class Question(models.Model):
    # ...
    def was_published_recently(self):
        return self.pub_date >= timezone.now().date() - datetime.timedelta(days=1)
}}} "	Bug	closed	Documentation	3.1	Normal	invalid	Tutorial 2, TypeError		Unreviewed	0	0	0	0	0	0
