summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorStanislas Guerra <stanislas.guerra@gmail.com>2014-05-21 12:32:19 +0200
committerTim Graham <timograham@gmail.com>2014-08-04 09:39:02 -0400
commit98e8da3709e400d549e87c7ff1450a2685c0adcf (patch)
treed2532acc84686fdff908807998487d46841e9ef8 /docs
parentbf5382c6e549d78da9f7029cd86686459b52eaed (diff)
Fixed #16311 -- Added a RelatedOnlyFieldListFilter class in admin.filters.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/contrib/admin/index.txt14
-rw-r--r--docs/releases/1.8.txt5
2 files changed, 19 insertions, 0 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
index 958551d660..8d69ac6e82 100644
--- a/docs/ref/contrib/admin/index.txt
+++ b/docs/ref/contrib/admin/index.txt
@@ -880,6 +880,20 @@ subclass::
('is_staff', admin.BooleanFieldListFilter),
)
+ .. versionadded:: 1.8
+
+ You can now limit the choices of a related model to the objects
+ involved in that relation using ``RelatedOnlyFieldListFilter``::
+
+ class BookAdmin(admin.ModelAdmin):
+ list_filter = (
+ ('author', admin.RelatedOnlyFieldListFilter),
+ )
+
+ Assuming ``author`` is a ``ForeignKey`` to a ``User`` model, this will
+ limit the ``list_filter`` choices to the users who have written a book
+ instead of listing all users.
+
.. note::
The ``FieldListFilter`` API is considered internal and might be
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index 07dd783d0b..9634b04db4 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -39,6 +39,11 @@ Minor features
:attr:`~django.contrib.admin.InlineModelAdmin.show_change_link` that
supports showing a link to an inline object's change form.
+* Use the new ``django.contrib.admin.RelatedOnlyFieldListFilter`` in
+ :attr:`ModelAdmin.list_filter <django.contrib.admin.ModelAdmin.list_filter>`
+ to limit the ``list_filter`` choices to foreign objects which are attached to
+ those from the ``ModelAdmin``.
+
:mod:`django.contrib.auth`
^^^^^^^^^^^^^^^^^^^^^^^^^^