Commit 43bb6727 authored by Tim Graham's avatar Tim Graham
Browse files

[1.9.x] Fixed #26339 -- Updated Question.was_published_recently() in tutorial...

[1.9.x] Fixed #26339 -- Updated Question.was_published_recently() in tutorial 7 to reflect changes in tutorial 5.

Backport of 602a38d8 from master
parent e8d94cda
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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?'