mirror of
https://github.com/django/django.git
synced 2025-10-29 00:26:07 +00:00
Fixed #33322 -- Fixed loss of assigned related object when saving relation with bulk_update().
This commit is contained in:
committed by
Mariusz Felisiak
parent
9ac92b1efc
commit
ed2018037d
@@ -549,6 +549,8 @@ class QuerySet:
|
||||
raise ValueError('bulk_update() cannot be used with primary key fields.')
|
||||
if not objs:
|
||||
return 0
|
||||
for obj in objs:
|
||||
obj._prepare_related_fields_for_save(operation_name='bulk_update', fields=fields)
|
||||
# PK is used twice in the resulting update query, once in the filter
|
||||
# and once in the WHEN. Each field will also have one CAST.
|
||||
connection = connections[self.db]
|
||||
|
||||
Reference in New Issue
Block a user