From 602a38d87e4b0d9c5e43678c33208627ca84ce2a Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Wed, 9 Mar 2016 11:21:33 -0500 Subject: [PATCH] Fixed #26339 -- Updated Question.was_published_recently() in tutorial 7 to reflect changes in tutorial 5. --- docs/intro/tutorial07.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/intro/tutorial07.txt b/docs/intro/tutorial07.txt index ecfd90d7f2c..cc39abf2471 100644 --- a/docs/intro/tutorial07.txt +++ b/docs/intro/tutorial07.txt @@ -232,7 +232,8 @@ attributes, as follows: class Question(models.Model): # ... def was_published_recently(self): - return self.pub_date >= timezone.now() - datetime.timedelta(days=1) + now = timezone.now() + return now - datetime.timedelta(days=1) <= self.pub_date <= now was_published_recently.admin_order_field = 'pub_date' was_published_recently.boolean = True was_published_recently.short_description = 'Published recently?'