diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-07-10 04:16:26 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-07-10 04:16:26 +0000 |
| commit | c1847294b8c1b97993a945d43e50c56c0486ceed (patch) | |
| tree | d7162c410745dc177c3399c95a2604b9aeb75dfe /docs/model-api.txt | |
| parent | 5ce4a56a7cde90afe3214d7f2ebde1cce1e22215 (diff) | |
Fixed #2301 -- Added list_display_links option to 'class Admin', which regulates which fields in the change list have links. Thanks, kilian
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3307 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/model-api.txt')
| -rw-r--r-- | docs/model-api.txt | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/docs/model-api.txt b/docs/model-api.txt index 0dc98416a3..c4d57bf8c4 100644 --- a/docs/model-api.txt +++ b/docs/model-api.txt @@ -1225,6 +1225,33 @@ A few special cases to note about ``list_display``: return self.birthday.strftime('%Y')[:3] + "0's" decade_born_in.short_description = 'Birth decade' +``list_display_links`` +---------------------- + +Set ``list_display_links`` to control which fields in ``list_display`` should +be linked to the "change" page for an object. + +By default, the change list page will link the first column -- the first field +specified in ``list_display`` -- to the change page for each item. But +``list_display_links`` lets you change which columns are linked. Set +``list_display_links`` to a list or tuple of field names (in the same format as +``list_display``) to link. + +``list_display_links`` can specify one or many field names. As long as the +field names appear in ``list_display``, Django doesn't care how many (or how +few) fields are linked. The only requirement is: If you want to use +``list_display_links``, you must define ``list_display``. + +In this example, the ``first_name`` and ``last_name`` fields will be linked on +the change list page:: + + class Admin: + list_display = ('first_name', 'last_name', 'birthday') + list_display_links = ('first_name', 'last_name') + +Finally, note that in order to use ``list_display_links``, you must define +``list_display``, too. + ``list_filter`` --------------- |
