Fixed #24417 -- Added ModelAdmin.get_list_select_related()

This commit is contained in:
Loek van Gent 2015-03-16 11:00:16 +01:00 committed by Tim Graham
parent 8d90489fe0
commit 35b3158d52
4 changed files with 47 additions and 5 deletions

View file

@ -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