Ticket #6074: patch.diff
File patch.diff, 1.5 KB (added by , 17 years ago) |
---|
-
django/db/models/query.py
714 714 715 715 def get_sql(self, opts): 716 716 joins, where, params = SortedDict(), [], [] 717 for val in self.args :717 for val in self.args[:-1]: 718 718 try: 719 719 joins2, where2, params2 = val.get_sql(opts) 720 720 joins.update(joins2) 721 721 where.extend(where2) 722 722 params.extend(params2) 723 723 except EmptyResultSet: 724 if not isinstance(self, QOr):724 if not(isinstance(self, QOr)): 725 725 raise EmptyResultSet 726 joins2, where2, params2 = self.args[-1].get_sql(opts) 727 joins.update(joins2) 728 where.extend(where2) 729 params.extend(params2) 726 730 if where: 727 731 return joins, ['(%s)' % self.operator.join(where)], params 728 732 return joins, [], params -
tests/modeltests/or_lookups/models.py
116 116 [<Article: Hello>] 117 117 >>> Article.objects.complex_filter(Q(pk=1) | Q(pk=2)) 118 118 [<Article: Hello>, <Article: Goodbye>] 119 120 # Check that Q(id__in=[]) returns the same results as Q(id__in=[]) | Q(id__in=[]) when used with filter : 121 >>> Article.objects.filter(Q(id__in=[]) | Q(id__in=[])) 122 [] 119 123 """}