fix handle_m2m_changed
This commit is contained in:
parent
7ba2f60ce3
commit
576be08232
2 changed files with 5 additions and 1 deletions
|
@ -247,6 +247,9 @@ class DatabaseOperationCollection(BaseSchema):
|
||||||
def append(self, item: DatabaseOperation):
|
def append(self, item: DatabaseOperation):
|
||||||
self.operations.append(item)
|
self.operations.append(item)
|
||||||
|
|
||||||
|
def __getitem__(self, item):
|
||||||
|
return self.operations[item]
|
||||||
|
|
||||||
def prefetch(self) -> "PrefetchedDatabaseOperationCollection":
|
def prefetch(self) -> "PrefetchedDatabaseOperationCollection":
|
||||||
return PrefetchedDatabaseOperationCollection(operations=self, instances=self.prev.get_instances())
|
return PrefetchedDatabaseOperationCollection(operations=self, instances=self.prev.get_instances())
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,8 @@ class DatabaseOverlayManager:
|
||||||
|
|
||||||
if self.operations:
|
if self.operations:
|
||||||
last_change = self.operations[-1]
|
last_change = self.operations[-1]
|
||||||
if isinstance(last_change, UpdateManyToManyOperation) and last_change == ref and last_change == field.name:
|
if (isinstance(last_change, UpdateManyToManyOperation)
|
||||||
|
and last_change.obj == ref and last_change == field.name):
|
||||||
if action == "post_add":
|
if action == "post_add":
|
||||||
last_change.add_values.update(pk_set)
|
last_change.add_values.update(pk_set)
|
||||||
last_change.remove_values.difference_update(pk_set)
|
last_change.remove_values.difference_update(pk_set)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue