Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#23588 closed Cleanup/optimization (fixed)

list_display method attributes description links

Reported by: eliasvc Owned by: Curtis Maloney
Component: Documentation Version: 1.7
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hello,

This is a piece of code that first describe the use of method attributes in callback functions used in list_display on Django tutorial, page two https://docs.djangoproject.com/en/1.7/intro/tutorial02/

class Question(models.Model):
    # ...
    def was_published_recently(self):
        return self.pub_date >= timezone.now() - datetime.timedelta(days=1)
    was_published_recently.admin_order_field = 'pub_date'
    was_published_recently.boolean = True
    was_published_recently.short_description = 'Published recently?'

The problem is none of those method attribute definitions take you somewhere where it describes what they do. It can be very confusing for a person starting out. In fact, it would be awesome if there was some kind of index of method attributes one can use since their descriptions on the admin page are scattered.

Change History (4)

comment:1 by Curtis Maloney, 10 years ago

Needs documentation: set
Owner: changed from nobody to Curtis Maloney
Status: newassigned
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

comment:2 by Curtis Maloney, 10 years ago

The simplest solution is to just add a link after this along the lines of:

For more information on these method properties, see list_options_

linking to the Admin.list_options doco. There's an earlier link where it's mentioned the first time, but it doesn't hurt to reinforce.

comment:3 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In 3a550bb6d32172fc1ec5dd314d20ef1235db995a:

Fixed #23588 -- Added a link in tutorial for list_display options.

comment:4 by Tim Graham <timograham@…>, 10 years ago

In b050dc46a9758e370c5b05ff25a133b741ffe465:

[1.7.x] Fixed #23588 -- Added a link in tutorial for list_display options.

Backport of 3a550bb6d32172fc1ec5dd314d20ef1235db995a from master

Note: See TracTickets for help on using tickets.
Back to Top