From 0c634de4e6950ec6fb83ab420b4af9c645b28acd Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Fri, 5 Sep 2025 11:54:01 +0100 Subject: Refs #36593 -- Made ModelAdmin.list_select_related = False more efficient. This change makes `list_select_related = False` avoid unnecessary joins by only selecting the related fields that are actually used in `list_display`. Consequently, it avoids one code path that calls `QuerySet.select_related()` with no arguments, which is targeted for deprecation. --- docs/releases/6.1.txt | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'docs') diff --git a/docs/releases/6.1.txt b/docs/releases/6.1.txt index 412a997019..89ff52be4d 100644 --- a/docs/releases/6.1.txt +++ b/docs/releases/6.1.txt @@ -99,6 +99,11 @@ Minor features preserve :ref:`named groups ` (e.g. ``choices=[("Group", [("1", "Item")]), ...]``). +* When :attr:`.ModelAdmin.list_select_related` is ``False`` (the default), + the change list now selects only the foreign key fields specified in + :attr:`.ModelAdmin.list_display`, rather than all foreign key fields. This + should improve performance for models with many foreign key fields. + * The :attr:`~django.contrib.admin.ModelAdmin.delete_confirmation_max_display` option allows customizing how many objects are displayed on admin delete confirmation pages before the remainder is truncated. The default is @@ -480,6 +485,9 @@ backends. * The undocumented ``InclusionAdminNode.__init__()`` now takes the template tag ``name`` as the first positional argument. +* The undocumented ``ChangeList.has_related_field_in_list_display()`` method + has been replaced with ``ChangeList.get_select_related_fields()``. + :mod:`django.contrib.auth` -------------------------- -- cgit v1.3