Re: [Django] #34339: Allow overriding construct_search(). (was: Enhancement: easier search field customization)

2 views
Skip to first unread message

Django

unread,
Feb 15, 2023, 8:01:09 AM2/15/23
to django-...@googlegroups.com
#34339: Allow overriding construct_search().
-------------------------------+--------------------------------------
Reporter: Ramez Issac | Owner: nobody
Type: New feature | Status: closed
Component: contrib.admin | Version: 4.1
Severity: Normal | Resolution: wontfix
Keywords: admin search | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* type: Uncategorized => New feature
* resolution: => wontfix
* easy: 1 => 0


Comment:

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

In such cases, you can always use the `__exact` lookup, e.g.
{{{#!python
class MyAdmin(admin.ModelAdmin):
search_fields = ['client_id__exact']
}}}
There is no need to change `construct_search()`.

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

Reply all
Reply to author
Forward
0 new messages