#30790: `autocomplete_fields` checks restrict usage to `search_fields` being
defined instead of `get_search_fields`
-----------------------------------------+------------------------
               Reporter:  Chad G Hansen  |          Owner:  nobody
                   Type:  Bug            |         Status:  new
              Component:  contrib.admin  |        Version:  2.2
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 It looks like in django.contrib.admin.options
 (https://github.com/django/django/blob/master/django/contrib/admin/options.py)
 all references to retrieving `search_fields` are done through a call to
 `get_search_fields`.

 However, the checks setup for the autocomplete fields feature only check
 to see if search_fields is defined and not if `get_search_fields` returns
 something.

 
https://github.com/django/django/blob/master/django/contrib/admin/checks.py#L189

 I'm proposing this line:

 `elif not related_admin.search_fields:`

 Be changed to also work when `get_search_fields` returns something:

 `elif not related_admin.search_fields and not
 related_admin.get_search_fields(None):`

 I'm changed this in my local version of Django that I have installed in my
 project and it works!

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.e0528876a524f9fcfdcf89dbcb930a3d%40djangoproject.com.

Reply via email to