Code

Opened 5 years ago

Closed 5 years ago

#11135 closed (invalid)

'was_published_today' in Tutorial 2

Reported by: Marcin Pekalski <mpekalski@…> 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: UI/UX:

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

Attachments (0)

Change History (1)

comment:1 Changed 5 years ago by kmtracey

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

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.

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.