#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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/056.c0921ee301fbd2a4fbf3f51db49ee4ff%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to