Fixed #19513, #18580 -- Fixed crash on QuerySet.update() after annotate().

This commit is contained in:
David Sanders 2016-04-17 10:03:08 -07:00 committed by Tim Graham
parent 06acb3445f
commit a84344bc53
3 changed files with 28 additions and 2 deletions

View file

@ -632,6 +632,8 @@ class QuerySet(object):
self._for_write = True
query = self.query.clone(sql.UpdateQuery)
query.add_update_values(kwargs)
# Clear any annotations so that they won't be present in subqueries.
query._annotations = None
with transaction.atomic(using=self.db, savepoint=False):
rows = query.get_compiler(self.db).execute_sql(CURSOR)
self._result_cache = None