Opened 15 years ago
Closed 15 years ago
#15883 closed Bug (invalid)
Error in tutorial 01 models.py when defining was_published_today()
| Reported by: | anonymous | Owned by: | nobody |
|---|---|---|---|
| Component: | *.djangoproject.com | Version: | 1.3 |
| Severity: | Normal | Keywords: | tutorial, custo method |
| 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/tutorial01/
This custom method is exposed as a example:
import datetime
# ...
class Poll(models.Model):
# ...
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
The return clause of this method should be: return self.pub_date == datetime.date.today()
Regards !
Change History (1)
comment:1 by , 15 years ago
| Resolution: | → invalid |
|---|---|
| Severity: | Release blocker → Normal |
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
pub_dateis defined as aDateTimeField, thusself.pub_dateis adatetime.datetimeinstance, not adatetime.dateinstance.