summaryrefslogtreecommitdiff
path: root/docs/intro/tutorial07.txt
diff options
context:
space:
mode:
Diffstat (limited to 'docs/intro/tutorial07.txt')
-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?'