1👍
You’re trying to call save()
but not storing instance of it in u
and use commit=False
this will not hit database it will store instance in memory after your proccess is finished you can save it. check more info about save() method.
# Upload entity data
u = Upload(
message=request.POST["upload_msg"]
)
# saving u here to be able to use u.datetime later
u = u.save(commit=False)
# new page for the upload entity
page = Page(
title="notes for Upload " + str(u.datetime),
content="This page is empty..."
)
page.save()
u.page = page
u.save()
Source:stackexchange.com