[Django] #34339: Enhancement: easier search field customization

2 views
Skip to first unread message

Django

unread,
Feb 15, 2023, 7:39:53 AM2/15/23
to django-...@googlegroups.com
#34339: Enhancement: easier search field customization
-----------------------------------------+------------------------------
Reporter: Ramez Issac | Owner: nobody
Type: Uncategorized | Status: new
Component: contrib.admin | Version: 4.1
Severity: Normal | Keywords: admin search
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-----------------------------------------+------------------------------
In ModelAdmin, `get_search_result` uses an ''inner'' function
`construct_search` to add the __icontains , istartswith, iexact

It can be much easier for more customization, if construct_search function
was override-able.


FYI, My Case is: i can not add a related id field to search_fields...
have to use traversing .

{{{
class MyAdmin(admin.ModelAdmin):
search_fields = ['client_id', # wont work
'client__id' # will work ]

}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/34339>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Reply all
Reply to author
Forward
0 new messages