mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Fixed #28838 -- Fixed Model.save() crash if the base manager annotates with a related field.
This commit is contained in:
parent
cbac11f962
commit
8dc675d90f
3 changed files with 31 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue