summaryrefslogtreecommitdiff
path: root/django/db/models/sql/subqueries.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/models/sql/subqueries.py')
-rw-r--r--django/db/models/sql/subqueries.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/django/db/models/sql/subqueries.py b/django/db/models/sql/subqueries.py
index 316a5c684d..fc9683064f 100644
--- a/django/db/models/sql/subqueries.py
+++ b/django/db/models/sql/subqueries.py
@@ -142,7 +142,11 @@ class UpdateQuery(Query):
that will be used to generate the UPDATE query. Might be more usefully
called add_update_targets() to hint at the extra information here.
"""
- self.values.extend(values_seq)
+ for field, model, val in values_seq:
+ if hasattr(val, 'resolve_expression'):
+ # Resolve expressions here so that annotations are no longer needed
+ val = val.resolve_expression(self, allow_joins=False, for_save=True)
+ self.values.append((field, model, val))
def add_related_update(self, model, field, value):
"""