Opened 104 minutes ago

Last modified 11 minutes ago

#36881 assigned Bug

Documented list of support fields for ModelAdmin.search_fields is inaccurate

Reported by: Tim Graham Owned by: Amar
Component: Documentation Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Since Django 1.0, the documentation for ModelAdmin.search_fields has said, "These fields should be some kind of text field, such as CharField or TextField.", however, this isn't the extent of what's supported. For example, in the test in 76ccce64cc3d66cfec075651c3d2239fda747dc2 uses search_fields = ['child__name', 'child__age'] (the latter is an IntegerField) and 6bc4ff36db0d85ac96ca91ae758159ee43836f86 tests search_fields = ['group__pk']. That said, there may be performance issues with non-integer fields, see ticket:26001#comment:24, so it may be prudent to try to address that first, or at least document the caveats of using non-string fields.

Change History (2)

comment:1 by Simon Charette, 77 minutes ago

As extra point of reference #36865 is the ticket avoiding adding unnecessary cast for __exact lookups against non-textual fields.

comment:2 by Amar, 11 minutes ago

Owner: set to Amar
Status: newassigned
Note: See TracTickets for help on using tickets.
Back to Top