diff options
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 0e6828b0f1..638161afc2 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -239,7 +239,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 |
