5👍
Don’t commit when saving your save. As documented here if you specify commit=True
it will try to write the M2M mapping at the same time. You don’t want that to happen.
By specifying a vale of False
instead, you can call save_m2m
later to save the mapping, or create your own mapping instead. You need to do the latter and the rest of your code is already doing the right thing for that.
Source:stackexchange.com