Opened 16 years ago
Closed 16 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: | no | UI/UX: | no |
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.
Note:
See TracTickets
for help on using tickets.
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.