summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRamiro Morales <cramm0@gmail.com>2013-09-06 15:25:13 -0300
committerTim Graham <timograham@gmail.com>2013-10-01 14:25:54 -0400
commit1d0fc61b1cadee584a27dbbe3ef3e21fd3202c85 (patch)
tree86a983c01d2bc888dd0511d3855b56a6a94c7ea6 /docs
parentbf757a2f4dad519fac1b4a458376de3a040f5ca8 (diff)
Fixed #15185 -- Allowed ModelAdmin.list_display_links=None to disable change list links.
Thanks rm_ for the suggestion.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/contrib/admin/index.txt42
-rw-r--r--docs/releases/1.7.txt4
2 files changed, 33 insertions, 13 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
index 2e02785e81..8873375174 100644
--- a/docs/ref/contrib/admin/index.txt
+++ b/docs/ref/contrib/admin/index.txt
@@ -648,19 +648,21 @@ subclass::
.. attribute:: ModelAdmin.list_display_links
- Set ``list_display_links`` to control which fields in ``list_display``
- should be linked to the "change" page for an object.
+ Use ``list_display_links`` to control if and which fields in
+ :attr:`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 fields (in the same
- format as ``list_display``) to link.
+ But ``list_display_links`` lets you change this:
- ``list_display_links`` can specify one or many fields. As long as the
- fields 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``.
+ * Set it to ``None`` to get no links at all.
+ * Set it to a list or tuple of fields (in the same format as
+ ``list_display``) whose columns you want converted to links.
+
+ You can specify one or many fields. As long as the fields appear in
+ ``list_display``, Django doesn't care how many (or how few) fields are
+ linked. The only requirement is that if you want to use
+ ``list_display_links`` in this fashion, you must define ``list_display``.
In this example, the ``first_name`` and ``last_name`` fields will be
linked on the change list page::
@@ -669,7 +671,17 @@ subclass::
list_display = ('first_name', 'last_name', 'birthday')
list_display_links = ('first_name', 'last_name')
- .. _admin-list-editable:
+ In this example, the change list page grid will have no links::
+
+ class AuditEntryAdmin(admin.ModelAdmin):
+ list_display = ('timestamp', 'message')
+ list_display_links = None
+
+ .. versionchanged:: 1.7
+
+ ``None`` was added as a valid ``list_display_links`` value.
+
+.. _admin-list-editable:
.. attribute:: ModelAdmin.list_editable
@@ -1242,9 +1254,13 @@ templates used by the :class:`ModelAdmin` views:
The ``get_list_display_links`` method is given the ``HttpRequest`` and
the ``list`` or ``tuple`` returned by :meth:`ModelAdmin.get_list_display`.
- It is expected to return a ``list`` or ``tuple`` of field names on the
- changelist that will be linked to the change view, as described in the
- :attr:`ModelAdmin.list_display_links` section.
+ It is expected to return either ``None`` or a ``list`` or ``tuple`` of field
+ names on the changelist that will be linked to the change view, as described
+ in the :attr:`ModelAdmin.list_display_links` section.
+
+ .. versionchanged:: 1.7
+
+ ``None`` was added as a valid ``get_list_display_links()`` return value.
.. method:: ModelAdmin.get_fields(self, request, obj=None)
diff --git a/docs/releases/1.7.txt b/docs/releases/1.7.txt
index a978bb8ac1..d613220508 100644
--- a/docs/releases/1.7.txt
+++ b/docs/releases/1.7.txt
@@ -164,6 +164,10 @@ Minor features
new :func:`~django.contrib.admin.register` decorator to register a
:class:`~django.contrib.admin.ModelAdmin`.
+* You may specify :meth:`ModelAdmin.list_display_links
+ <django.contrib.admin.ModelAdmin.list_display_links>` ``= None`` to disable
+ links on the change list page grid.
+
:mod:`django.contrib.auth`
^^^^^^^^^^^^^^^^^^^^^^^^^^