#5833: Custom FilterSpecs
-------------------------------------------+--------------------------------
Reporter: Honza_Kral | Owner: jkocherhans
Status: assigned | Milestone:
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords: nfa-someday
list_filter filterspec nfa-changelist ep2008
Stage: Accepted | Has_patch: 1
Needs_docs: 1 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by subsume):
* cc: [email protected] (added)
Comment:
One problem I have with this--and this may be completely irrelevant, is
the get_query_set method.
The problem I see is that it accepts and returns a filtered queryset and
these FilterSpecs chain like so:
Model.objects.filter(x=y).filter(z=y).filter(a=y)
When it comes to related objects, this is a problem because:
Model.objects.filter(x__z=y).filter(x__y=z).filter(y__x=a)
...is not the same as:
Model.objects.filter(Q(x__z=y)&Q(x__y=z)&Q(y__x=a))
One solution may be to allow get_query_set to return a Q() object and then
string them together as above. Sure, you're still locked into a chain of
&-joined Q objects but you already are and it could be the stuff of future
tickets.
If there's a better place to have this discussion please forward me along.
=). Thanks.
--
Ticket URL: <http://code.djangoproject.com/ticket/5833#comment:74>
Django <http://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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.