Opened 6 years ago

Closed 6 years ago

#7890 closed (invalid)

tutorial code - don't know where to insert

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


you write:

Customize the admin change list
[...]But you can change that by giving that method a short_description attribute:

def was_published_today(self):
    return ==
was_published_today.short_description = 'Published today?'

I'm a Python beginner, and for me it is not clear where to put the last line, because in the this def "was_published_today" is a sub method of the Poll class.
But the above code snippet in your tutorial is not intendated, it is no tab in front of it.

At least I don't know where to input that...
(Maybe you'll laugh and say 'learn python' - but the rest of your tutorial is EXCELLENT for absolute beginners as well...)

Attachments (0)

Change History (1)

comment:1 Changed 6 years ago by Karen Tracey <kmtracey@…>

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

The django-users list would be a better place for questions like this. The answer is you put it exactly as shown, at the same indent level as the def for the was_published_today method.

Add Comment

Modify Ticket

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

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

Note: See TracTickets for help on using tickets.