4👍
✅
At first create B
instance, assign attributes to it, call save on it (now it have id) and then assign it to mashup.b
:
if cr:
b = B()
else:
if mashup.b is None:
b = B()
#.... (assign values to b attributes)
b.save()
mashup.b = b
mashup.save()
👤ndpu
Source:stackexchange.com