ignore empty Q objects when combining Q objects.
This commit is contained in:
		| @@ -59,8 +59,10 @@ class Q(object): | |||||||
|  |  | ||||||
|     def _combine(self, other, op): |     def _combine(self, other, op): | ||||||
|         obj = Q() |         obj = Q() | ||||||
|         obj.query = ['('] + copy.deepcopy(self.query) + [op] |         if self.query[0]: | ||||||
|         obj.query += copy.deepcopy(other.query) + [')'] |             obj.query = ['('] + copy.deepcopy(self.query) + [op] + copy.deepcopy(other.query) + [')'] | ||||||
|  |         else: | ||||||
|  |             obj.query = copy.deepcopy(other.query) | ||||||
|         return obj |         return obj | ||||||
|  |  | ||||||
|     def __or__(self, other): |     def __or__(self, other): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user