diff options
| author | Stanislas Guerra <stanislas.guerra@gmail.com> | 2014-05-21 12:32:19 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-08-04 09:39:02 -0400 |
| commit | 98e8da3709e400d549e87c7ff1450a2685c0adcf (patch) | |
| tree | d2532acc84686fdff908807998487d46841e9ef8 /docs/ref | |
| parent | bf5382c6e549d78da9f7029cd86686459b52eaed (diff) | |
Fixed #16311 -- Added a RelatedOnlyFieldListFilter class in admin.filters.
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/contrib/admin/index.txt | 14 |
1 files changed, 14 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 |
