It gets improved in the
[https://docs.djangoproject.com/en/1.9/intro/tutorial05/#fixing-the-bug
Tutorial 5 section].
It shows:
{{{#!python
class Question(models.Model):
# ...
def was_published_recently(self):
return self.pub_date >= timezone.now() -
datetime.timedelta(days=1)
}}}
When it should be:
{{{#!python
class Question(models.Model):
# ...
def was_published_recently(self):
now = timezone.now()
return now - datetime.timedelta(days=1) <= self.pub_date <= now
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26339>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"602a38d87e4b0d9c5e43678c33208627ca84ce2a" 602a38d]:
{{{
#!CommitTicketReference repository=""
revision="602a38d87e4b0d9c5e43678c33208627ca84ce2a"
Fixed #26339 -- Updated Question.was_published_recently() in tutorial 7 to
reflect changes in tutorial 5.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26339#comment:1>
Comment (by Tim Graham <timograham@…>):
In [changeset:"43bb6727d09347f8c4c1a6541e2086a1a69811e1" 43bb672]:
{{{
#!CommitTicketReference repository=""
revision="43bb6727d09347f8c4c1a6541e2086a1a69811e1"
[1.9.x] Fixed #26339 -- Updated Question.was_published_recently() in
tutorial 7 to reflect changes in tutorial 5.
Backport of 602a38d87e4b0d9c5e43678c33208627ca84ce2a from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26339#comment:2>