mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +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
@@ -36,6 +36,12 @@ class ParentAdmin(admin.ModelAdmin):
|
||||
list_select_related = ['child']
|
||||
|
||||
|
||||
class ParentAdminTwoSearchFields(admin.ModelAdmin):
|
||||
list_filter = ['child__name']
|
||||
search_fields = ['child__name', 'child__age']
|
||||
list_select_related = ['child']
|
||||
|
||||
|
||||
class ChildAdmin(admin.ModelAdmin):
|
||||
list_display = ['name', 'parent']
|
||||
list_per_page = 10
|
||||
|
||||
Reference in New Issue
Block a user