diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-07-07 12:15:05 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-07 12:15:05 +0200 |
| commit | ae8338daf34fd746771e0678081999b656177bae (patch) | |
| tree | b9b3e84191821522e419b8633c60b99fa9511d6c /django/db/models/sql | |
| parent | cb0da637a69b79ab371be9ee202335190a3a506e (diff) | |
Fixed #31767 -- Fixed QuerySet.none() on combined queryset.
Diffstat (limited to 'django/db/models/sql')
| -rw-r--r-- | django/db/models/sql/query.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index c913267476..1623263964 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -305,6 +305,7 @@ class Query(BaseExpression): obj.annotation_select_mask = None else: obj.annotation_select_mask = self.annotation_select_mask.copy() + obj.combined_queries = tuple(query.clone() for query in self.combined_queries) # _annotation_select_cache cannot be copied, as doing so breaks the # (necessary) state in which both annotations and # _annotation_select_cache point to the same underlying objects. @@ -1777,6 +1778,8 @@ class Query(BaseExpression): def set_empty(self): self.where.add(NothingNode(), AND) + for query in self.combined_queries: + query.set_empty() def is_empty(self): return any(isinstance(c, NothingNode) for c in self.where.children) |
