exclude pk_only models from beeing save_related
This commit is contained in:
@ -191,7 +191,7 @@ class Model(ModelRow):
|
|||||||
value = [value]
|
value = [value]
|
||||||
|
|
||||||
for val in value:
|
for val in value:
|
||||||
if not val.saved or save_all:
|
if (not val.saved or save_all) and not val.__pk_only__:
|
||||||
await val.upsert()
|
await val.upsert()
|
||||||
update_count += 1
|
update_count += 1
|
||||||
if follow:
|
if follow:
|
||||||
|
|||||||
@ -155,4 +155,4 @@ def create_test_database():
|
|||||||
async def test_saving_related_fk_rel():
|
async def test_saving_related_fk_rel():
|
||||||
async with database:
|
async with database:
|
||||||
async with database.transaction(force_rollback=True):
|
async with database.transaction(force_rollback=True):
|
||||||
await Report.objects.select_all(follow=True).all()
|
await Report.objects.select_all(follow=True).all()
|
||||||
|
|||||||
Reference in New Issue
Block a user