Code

Opened 5 years ago

Closed 5 years ago

#11227 closed (wontfix)

tutorial #02 -

Reported by: anon_who_is_annoyed_by_spam_filter Owned by: nobody
Component: Documentation Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

http://docs.djangoproject.com/en/dev/intro/tutorial02/#intro-tutorial02

Code part:

def was_published_today(self):
    return self.pub_date.date() == datetime.date.today()

This baffled me for some time - after adding anything I got false. The problem was with time zones - Django's settings.py had another time zone.

I would add a small comment in the documentation, or change datetime.date.today() to some function which respects time zone in settings.py.

Attachments (0)

Change History (1)

comment:1 Changed 5 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

In the tutorial, all the data should be created using Django, so all the data should have the same time zone. The tutorial has been run many times, by many people, in many time zones, and to the best of my knowledge, this is the first time this problem has been reported. Without more details to describe exactly what you did to generate this problem, I'm not sure what comment we should be adding.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.