Changeset 7342
- Timestamp:
- 03/21/08 05:59:25 (5 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/queryset-refactor/django/db/models/query.py
r7341 r7342 119 119 raise IndexError, e.args 120 120 121 def _merge_sanity_check(self, other): 122 """ 123 Checks that we are merging two comparable queyrset classes. 124 """ 125 if self.__class__ is not other.__class__: 126 raise TypeError("Cannot merge querysets of different types ('%s' and '%s'." 127 % (self.__class__.__name__, other.__class__.__name__)) 128 121 129 def __and__(self, other): 130 self._merge_sanity_check(other) 122 131 combined = self._clone() 123 132 combined.query.combine(other.query, sql.AND) … … 125 134 126 135 def __or__(self, other): 136 self._merge_sanity_check(other) 127 137 combined = self._clone() 128 138 combined.query.combine(other.query, sql.OR) … … 528 538 return c 529 539 540 def _merge_sanity_check(self, other): 541 super(ValuesQuerySet, self)._merge_sanity_check(other) 542 if (set(self.extra_names) != set(other.extra_names) or 543 set(self.field_names) != set(other.field_names)): 544 raise TypeError("Merging '%s' classes must involve the same values in each case." 545 % self.__class__.__name__) 546 530 547 class ValuesListQuerySet(ValuesQuerySet): 531 548 def iterator(self):
