diff options
| author | Hasan Ramezani <hasan.r67@gmail.com> | 2020-04-04 20:55:20 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-04-06 07:11:29 +0200 |
| commit | 4237050684427db45ea834fe89d9e11c0520201e (patch) | |
| tree | 111e56066d6f098306e9c12bbd3bbf5ec55b05c4 /django/db/models/sql | |
| parent | fa5e7e46d875d4143510944f19d79df7b1739bab (diff) | |
Fixed #31420 -- Fixed crash when filtering subquery annotation against a SimpleLazyObject.
Thanks Simon Charette for the solution and analysis.
Diffstat (limited to 'django/db/models/sql')
| -rw-r--r-- | django/db/models/sql/query.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 9fe0c9a656..e5524a8198 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -233,7 +233,8 @@ class Query(BaseExpression): @property def output_field(self): if len(self.select) == 1: - return self.select[0].field + select = self.select[0] + return getattr(select, 'target', None) or select.field elif len(self.annotation_select) == 1: return next(iter(self.annotation_select.values())).output_field |
