mirror of
https://github.com/django/django.git
synced 2025-10-28 16:16:12 +00:00
Fixed #28838 -- Fixed Model.save() crash if the base manager annotates with a related field.
This commit is contained in:
@@ -701,6 +701,8 @@ class QuerySet:
|
||||
"Cannot update a query once a slice has been taken."
|
||||
query = self.query.chain(sql.UpdateQuery)
|
||||
query.add_update_fields(values)
|
||||
# Clear any annotations so that they won't be present in subqueries.
|
||||
query._annotations = None
|
||||
self._result_cache = None
|
||||
return query.get_compiler(self.db).execute_sql(CURSOR)
|
||||
_update.alters_data = True
|
||||
|
||||
Reference in New Issue
Block a user