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.
--
Ticket URL: <https://code.djangoproject.com/ticket/23588>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => assigned
* needs_better_patch: => 0
* needs_tests: => 0
* owner: nobody => funkybob
* needs_docs: => 1
* type: Uncategorized => Cleanup/optimization
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/23588#comment:1>
Comment (by funkybob):
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/23588#comment:2>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"3a550bb6d32172fc1ec5dd314d20ef1235db995a"]:
{{{
#!CommitTicketReference repository=""
revision="3a550bb6d32172fc1ec5dd314d20ef1235db995a"
Fixed #23588 -- Added a link in tutorial for list_display options.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23588#comment:3>
Comment (by Tim Graham <timograham@…>):
In [changeset:"b050dc46a9758e370c5b05ff25a133b741ffe465"]:
{{{
#!CommitTicketReference repository=""
revision="b050dc46a9758e370c5b05ff25a133b741ffe465"
[1.7.x] Fixed #23588 -- Added a link in tutorial for list_display options.
Backport of 3a550bb6d32172fc1ec5dd314d20ef1235db995a from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23588#comment:4>