Opened 3 months ago

Closed 2 months ago

#35423 closed Cleanup/optimization (invalid)

Show which fields are being searched in Admin change_list's `search_fields`

Reported by: Ren de la Cruz Owned by: nobody
Component: contrib.admin Version: 5.0
Severity: Normal Keywords: admin, search_fields, change_list, search, ui
Cc: Thibaud Colas, Tom Carrick, Sarah Abderemane Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: yes


In any Django Admin change_list pages, when including a search_fields attribute, the search bar does not indicate which fields are searchable. This can easily be confused with attributes on the sidebar list_filter.

Maybe something like a greyed-out caption indicating the model fields included in search_fields.

Change History (5)

comment:1 by Natalia Bidart, 3 months ago

Cc: Thibaud Colas Tom Carrick Sarah Abderemane added
Triage Stage: UnreviewedAccepted
Type: New featureCleanup/optimization

Hello RenDelaCruz, thank you for your interest in making Django better.

I can relate to your report, and I can see value in a small help text below the search box. I'm tentatively accepting to see how this would look like in the UI, are you available to propose a PR? We would love to count on your contribution for this!

We should definitely consider the accessibility aspects of this, but IMHO as long as the adding is equivalent to form fields help text, this should comply with all the accessibility requirements.

comment:2 by Rajeesh Punathil, 3 months ago

Yes, this can be quickly added as a small help text below (a minor change in template only) and I tried that. But what about values like user__email, name__exact, ^question, @descr, etc? We may need to use verbose equivalents for each queryset lookup or its shortcut, because the admin staff may not have technical knowledge to understand them as they are given. What's the suggestion?

Last edited 3 months ago by Rajeesh Punathil (previous) (diff)

comment:3 by Jakub Szafrański, 2 months ago

If we aim for readability, perhaps it would make sense to resolve the fields and use field labels (if present) and some verbose text explaining what lookup is used?

Having many search_fields and/or fields with various lookups can lead to a potentially long help text which might hinder readability, so perhaps using some icons would make sense.

I can have a look at it and experiment with various formats so we can decide

comment:4 by Sarah Boyce, 2 months ago

I think it's quite rare to have a help text that goes deep into the specifics of what is searchable and what isn't.
We don't have an icon on columns when filters are applied, or text highlighting of searched text we found (which are more common UI patterns).
I think going into the specifics of search in the user interface is not worth it. Most people "search" to find out what the search does.

comment:5 by Natalia Bidart, 2 months ago

Resolution: invalid
Status: newclosed
Triage Stage: AcceptedUnreviewed

I see your point Sarah, thanks for sharing your view on this matter. While I think it would be a nice addition to have a descriptive help text under the search field, I agree this may need a wider discussion and a higher level design that would consider other UI elements.

Closing as invalid following the ticket triaging process. Ren, please consider starting a new conversation on the Django Forum, where you'll reach a wider audience and likely get extra feedback. If there is a community agreement for this feature request, you are welcome to come back to the ticket and point to the forum topic, so we can then re-open it.

Note: See TracTickets for help on using tickets.
Back to Top