Russell Keith-Magee wrote:
> You still need to parse kwargs to handle queries across joins (e.g.,
> Article.objects.filter(author__name__exact='fred'))
Just playing around with ideas, but what if you could do something like:
Article.objects.filter(author=Author.objects.filter(name='fred'))
It's a bit verbose, mainly because of the repeated .objects. and
.filter, but it does point to an interesting question: how hard would it
be for filter to create a join in cases where it is getting a related
object QuerySet, like above?
It also points to several possibilities that the current join kwargs
can't handle, such as:
authors = Author.objects.order_by('last_name', 'first_name')
articles = Article.objects.filter(author=authors).order_by('title')
At the very least, it gives a lazier alternative to __in for QuerySets.
In fact, why keep __in, anyway? Why not just have it check to see if
the object is scalar, QuerySet, or List/Tuple and "do the right thing"?
--
--Max Battcher--
http://www.worldmaker.net/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" 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-developers
-~----------~----~----~----~------~----~------~--~---