#37263: Admin changelist search crashes (500) on `__exact` search_fields with
choices
---------------------------------+----------------------------------------
Reporter: Adam Johnson | Owner: Adam Johnson
Type: Bug | Status: assigned
Component: contrib.admin | Version: 6.1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
---------------------------------+----------------------------------------
Comment (by Adam Johnson):
> BooleanField: The commit message explains that there is an increase in
search permissiveness for values that can be normalized by
formfield.to_python(). So for me, the permissive matching on truthy values
is fine.
Did you understand that a search for an arbitrary string now matches every
row where any boolean field is true? That’s a huge regression to me.
Previously, you'd need to serach for `true` to match truthy rows only.
Try running the new tests on the current `main`:
https://github.com/django/django/pull/21754/changes#diff-
640602cc17dc3e9a26db47f58b40a1289d5c0f1b5b0fe547810b1d962f6cde8bR996
> TypedChoiceField: I think this use case gives us a reason to reopen
#34156, which, when you connect the dots a little further, says that
TypedChoiceField is violating the contract that to_python() should return
the correct python types.
Oh yeah, that’s a problem! Thanks for looking into it.
--
Ticket URL: <
https://code.djangoproject.com/ticket/37263#comment:3>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.