Changeset 7765
- Timestamp:
- 06/26/08 06:42:12 (5 months ago)
- Files:
-
- django/trunk/django/db/models/query.py (modified) (3 diffs)
- django/trunk/tests/regressiontests/queries/models.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/db/models/query.py
r7763 r7765 219 219 def __and__(self, other): 220 220 self._merge_sanity_check(other) 221 if isinstance(other, EmptyQuerySet): 222 return other._clone() 221 223 combined = self._clone() 222 224 combined.query.combine(other.query, sql.AND) … … 226 228 self._merge_sanity_check(other) 227 229 combined = self._clone() 230 if isinstance(other, EmptyQuerySet): 231 return combined 228 232 combined.query.combine(other.query, sql.OR) 229 233 return combined … … 706 710 self._result_cache = [] 707 711 712 def __and__(self, other): 713 return self._clone() 714 715 def __or__(self, other): 716 return other._clone() 717 708 718 def count(self): 709 719 return 0 django/trunk/tests/regressiontests/queries/models.py
r7764 r7765 782 782 [] 783 783 784 Empty querysets can be merged with others. 785 >>> Note.objects.none() | Note.objects.all() 786 [<Note: n1>, <Note: n2>, <Note: n3>] 787 >>> Note.objects.all() | Note.objects.none() 788 [<Note: n1>, <Note: n2>, <Note: n3>] 789 >>> Note.objects.none() & Note.objects.all() 790 [] 791 >>> Note.objects.all() & Note.objects.none() 792 [] 793 784 794 """} 785 795
