On 5/5/06, Michael Radziej <[EMAIL PROTECTED]> wrote:
>
> what about providing class functions QuerySet.union(cls, qset_list),
> QuerySet.intersection(cls, qset_list), both returning cls, such as:
>
> def union(cls, qset_list):
>     """Returns the union of a list of QuerySets, a QuerySet."""
>     return reduce(cls.__or__, qset_list)
>
> union = classmethod(union)
>
> A class method, since you might want to subclass QuerySet (I do).
>
> I found myself needing this a lot, and I think this might be nice for
> everyone. If you like the idea, I'll provide the patch.

That would be pretty cool. You might want to include a way to do union
all as well as just union. I generally use the latter as it's supposed
to be faster for most (probably all) databases... that and I'm not
expecting duplicates for most union queries in the first place.

Joseph

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to