From 14c8504a37afad96ab93cf82f47b13bcc4d00621 Mon Sep 17 00:00:00 2001 From: Erik Cederstrand Date: Wed, 13 Oct 2021 07:31:25 +0200 Subject: [PATCH] Refs #25265 -- Allowed Query subclasses to build filters. --- django/db/models/sql/query.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 79499b28541..171e72cfb89 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -1760,7 +1760,7 @@ class Query(BaseExpression): ) """ # Generate the inner query. - query = Query(self.model) + query = self.__class__(self.model) query._filtered_relations = self._filtered_relations filter_lhs, filter_rhs = filter_expr if isinstance(filter_rhs, OuterRef):