Opened 15 years ago
Closed 15 years ago
#11135 closed (invalid)
'was_published_today' in Tutorial 2
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Documentation | Version: | 1.0 |
Severity: | Keywords: | tutorial | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The line
list_display = ('question', 'pub_date', 'was_published_today')
should be changed to
list_display = ('question', 'pub_date', was_published_today)
[no ' ' over was_published_today]
Moreover, I think there should be a word or two that datetime sould be imported in models.py
Note:
See TracTickets
for help on using tickets.
Why do you think the quotes should be removed? was_published_today, as set up in the first part of the tutorial, is a method of the Poll model, not an independent callable. The way it is specified in list display in the 2nd part of the tutorial matches how it should be based on the doc under list_display here: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#modeladmin-options.
Also, when the method is defined in the 1st part of the tutorial 'import datetime' is shown as part of the code snippet for adding the was_published_today method. It is not necessary to repeat that in part 2 -- the code should already be there from completing part 1, where it was explicitly noted that 'import datetime' is needed for that bit of code.