Hi, I have a currently WIP PR at https://github.com/django/django/pull/7727
The usage is currently something like this: qs1 = User.objects.all().values('username') qs2 = Group.objects.all().values('name') results = qs1.union(qs).distinct().order_by('name')[:10] (order_by does not work though yet) So far I have a few questions: * Should .union/.intersect etc return a new type of queryset or stay with the base QuerySet class (probably less code duplication) * We currently have a few methods which check can_filter and error out accordingly (ie you cannot filter after slicing), but as the error message in https://github.com/django/django/blob/master/django/db/models/query.py#L579 shows, this strongly relies on knowledge of the implementation of the filter. For combined querysets I basically need to limit everything aside from order by and limit/offset. Would a method like this make some sense (on the Query class): def is_allowed(self, action): if self.combinatorial and action not in ('set_operation', 'order_by', 'slicing'): raise SomeError('Cannot use this method on an combinatorial queryset') elif action == 'filter' and (self.low_mark or self.high_mark): raise SomeError('Cannot filter after slicing') * set_operator in base.py feels a bit weird (https://github.com/django/django/pull/7727/files#diff-53fcf3ac0535307033e0cfabb85c5301) -- any better options? * How can I change the generated order_by clause to reference the columns "unqualified" (ie without table name), can I somehow just realias every column? Cheers, Florian -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/1850fec7-2bcc-4efb-b0a4-2dea373592c2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.