mirror of
https://github.com/django/django.git
synced 2025-08-22 11:34:33 +00:00
Fixed #33435 -- Fixed invalid SQL generatered by Subquery.as_sql().
This commit is contained in:
parent
b55ebe3241
commit
f37face331
2 changed files with 11 additions and 1 deletions
|
@ -1149,7 +1149,8 @@ class Subquery(BaseExpression, Combinable):
|
|||
|
||||
def __init__(self, queryset, output_field=None, **extra):
|
||||
# Allow the usage of both QuerySet and sql.Query objects.
|
||||
self.query = getattr(queryset, 'query', queryset)
|
||||
self.query = getattr(queryset, 'query', queryset).clone()
|
||||
self.query.subquery = True
|
||||
self.extra = extra
|
||||
super().__init__(output_field)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue