#27303: Allow FilterSpecs to return Q-likes
-------------------------------+------------------------
Reporter: Yeago | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: 1.10
Severity: Normal | Keywords: filterspec
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------
Problems arise when filtering across relations in the admin. The current
method relies on FilterSpecs chaining filter() clauses. While these create
explicit ANDs when filtering on fields on a single table (expected), they
imply OR when a filter crosses a relation because each filter() clause
creates a new join.
Consider a case where someone would want to filter across all People who
have a Contact between dates X and Y that is on_phone (as opposed to
in_person). In the current state of the admin, you can't arrive at this
list because of the above subtlety with how chained filters() change
behavior when spanning relations (which I would argue, this hypothetical
user doesn't care about).
https://github.com/yeago/django-1/commit/bccabbfcf443f0fac511599ccfdf166bb1697b6b
I believe allowing FilterSpec objects to return Q-likes is a happy middle-
ground that doesn't break current assumptions.
--
Ticket URL: <https://code.djangoproject.com/ticket/27303>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.50af4ed490db681eeab6632bf138efdf%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.