summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorLoek van Gent <loek@1procentclub.nl>2015-03-16 11:00:16 +0100
committerTim Graham <timograham@gmail.com>2015-03-19 08:52:28 -0400
commit35b3158d52a5fe51d3b52aec1109a30a73c5abe9 (patch)
tree9e32f6e9a81e720af9ccce61a8c0d963152c2374 /docs
parent8d90489fe0049049f1f13c737ac51a24abf1efc3 (diff)
Fixed #24417 -- Added ModelAdmin.get_list_select_related()
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/contrib/admin/index.txt12
-rw-r--r--docs/releases/1.9.txt5
2 files changed, 16 insertions, 1 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
index d6b88f5f38..4b11fed58a 100644
--- a/docs/ref/contrib/admin/index.txt
+++ b/docs/ref/contrib/admin/index.txt
@@ -920,6 +920,9 @@ subclass::
will call ``select_related('author', 'category')``.
+ If you need to specify a dynamic value based on the request, you can
+ implement a :meth:`~ModelAdmin.get_list_select_related` method.
+
.. attribute:: ModelAdmin.ordering
Set ``ordering`` to specify how lists of objects should be ordered in the
@@ -932,7 +935,6 @@ subclass::
If you need to specify a dynamic order (for example depending on user or
language) you can implement a :meth:`~ModelAdmin.get_ordering` method.
-
.. attribute:: ModelAdmin.paginator
The paginator class to be used for pagination. By default,
@@ -1366,6 +1368,14 @@ templates used by the :class:`ModelAdmin` views:
to return the same kind of sequence type as for the
:attr:`~ModelAdmin.list_filter` attribute.
+.. method:: ModelAdmin.get_list_select_related(request)
+
+ .. versionadded:: 1.9
+
+ The ``get_list_select_related`` method is given the ``HttpRequest`` and
+ should return a boolean or list as :attr:`ModelAdmin.list_select_related`
+ does.
+
.. method:: ModelAdmin.get_search_fields(request)
The ``get_search_fields`` method is given the ``HttpRequest`` and is expected
diff --git a/docs/releases/1.9.txt b/docs/releases/1.9.txt
index c290739c95..20589c8fd6 100644
--- a/docs/releases/1.9.txt
+++ b/docs/releases/1.9.txt
@@ -43,6 +43,11 @@ Minor features
the old URL still redirects to the new one for backwards compatibility, but
it may be removed in a future version.
+* :meth:`ModelAdmin.get_list_select_related()
+ <django.contrib.admin.ModelAdmin.get_list_select_related>` was added to allow
+ changing the ``select_related()`` values used in the admin's changelist query
+ based on the request.
+
:mod:`django.contrib.auth`
^^^^^^^^^^^^^^^^^^^^^^^^^^