[Django] #26339: In tutorial 07, a was_published_recently method definition should be modified to reflect previous modifications

2 views
Skip to first unread message

Django

unread,
Mar 9, 2016, 11:10:42 AM3/9/16
to django-...@googlegroups.com
#26339: In tutorial 07, a was_published_recently method definition should be
modified to reflect previous modifications
-------------------------------+--------------------
Reporter: damiencaselli | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.9
Severity: Normal | Keywords: docs
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
In the [https://docs.djangoproject.com/en/1.9/intro/tutorial07/#customize-
the-admin-change-list Customize the admin change list section], the
`Question` class order improvements show an old version of the
`was_published_recently` method.

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.

Django

unread,
Mar 9, 2016, 11:23:12 AM3/9/16
to django-...@googlegroups.com
#26339: In tutorial 07, a was_published_recently method definition should be
modified to reflect previous modifications
---------------------------+----------------------------
Reporter: damiencaselli | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.9
Severity: Normal | Resolution: fixed

Keywords: docs | Triage Stage: Unreviewed
Has patch: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------+----------------------------
Changes (by Tim Graham <timograham@…>):

* 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>

Django

unread,
Mar 9, 2016, 11:23:20 AM3/9/16
to django-...@googlegroups.com
#26339: In tutorial 07, a was_published_recently method definition should be
modified to reflect previous modifications
---------------------------+----------------------------
Reporter: damiencaselli | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.9
Severity: Normal | Resolution: fixed

Keywords: docs | Triage Stage: Unreviewed
Has patch: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------+----------------------------

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>

Reply all
Reply to author
Forward
0 new messages