change order in save_related -> first upsert self then follow

This commit is contained in:
collerek
2021-03-30 17:33:30 +02:00
parent 347c056c30
commit 04047e4cd9
2 changed files with 4 additions and 4 deletions

View File

@ -191,6 +191,9 @@ class Model(ModelRow):
value = [value]
for val in value:
if not val.saved or save_all:
await val.upsert()
update_count += 1
if follow:
update_count = await val.save_related(
follow=follow,
@ -198,9 +201,6 @@ class Model(ModelRow):
relation_map=relation_map,
update_count=update_count,
)
if not val.saved or save_all:
await val.upsert()
update_count += 1
return update_count
async def update(self: T, **kwargs: Any) -> T: