mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #16063 -- Adjusted admin changelist searches spanning multi-valued relationships.
This reduces the likelihood of admin searches issuing queries with excessive joins.
This commit is contained in:
committed by
Mariusz Felisiak
parent
e1d673c373
commit
76ccce64cc
@@ -290,6 +290,26 @@ Dropped support for MariaDB 10.2
|
||||
Upstream support for MariaDB 10.2 ends in May 2022. Django 4.1 supports MariaDB
|
||||
10.3 and higher.
|
||||
|
||||
Admin changelist searches spanning multi-valued relationships changes
|
||||
---------------------------------------------------------------------
|
||||
|
||||
Admin changelist searches using multiple search terms are now applied in a
|
||||
single call to ``filter()``, rather than in sequential ``filter()`` calls.
|
||||
|
||||
For multi-valued relationships, this means that rows from the related model
|
||||
must match all terms rather than any term. For example, if ``search_fields``
|
||||
is set to ``['child__name', 'child__age']``, and a user searches for
|
||||
``'Jamal 17'``, parent rows will be returned only if there is a relationship to
|
||||
some 17-year-old child named Jamal, rather than also returning parents who
|
||||
merely have a younger or older child named Jamal in addition to some other
|
||||
17-year-old.
|
||||
|
||||
See the :ref:`spanning-multi-valued-relationships` topic for more discussion of
|
||||
this difference. In Django 4.0 and earlier,
|
||||
:meth:`~django.contrib.admin.ModelAdmin.get_search_results` followed the
|
||||
second example query, but this undocumented behavior led to queries with
|
||||
excessive joins.
|
||||
|
||||
Miscellaneous
|
||||
-------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user