summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-03-09 11:21:33 -0500
committerTim Graham <timograham@gmail.com>2016-03-09 11:22:59 -0500
commit43bb6727d09347f8c4c1a6541e2086a1a69811e1 (patch)
tree7c0421b13a1035ce20bfda1aeb0f8e4e7ebc11ce /docs
parente8d94cda9b4f30f6724f919882b61eb3279efafc (diff)
[1.9.x] Fixed #26339 -- Updated Question.was_published_recently() in tutorial 7 to reflect changes in tutorial 5.
Backport of 602a38d87e4b0d9c5e43678c33208627ca84ce2a from master
Diffstat (limited to 'docs')
-rw-r--r--docs/intro/tutorial07.txt3
1 files changed, 2 insertions, 1 deletions
diff --git a/docs/intro/tutorial07.txt b/docs/intro/tutorial07.txt
index ecfd90d7f2..cc39abf247 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?'