Documented list of supported fields for ModelAdmin.search_fields is inaccurate
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
(6)
| Owner: |
set to Amar
|
| Status: |
new → assigned
|
| Triage Stage: |
Unreviewed → Accepted
|
| Patch needs improvement: |
set
|
| Summary: |
Documented list of support fields for ModelAdmin.search_fields is inaccurate → Documented list of supported fields for ModelAdmin.search_fields is inaccurate
|
As extra point of reference #36865 is the ticket avoiding adding unnecessary cast for
__exactlookups against non-textual fields.