[Django]-Can't add object to Django's Many-To-Many Field

9👍

✅

You have to create the MZZ object and save() it first and then add an organization.

mzz = MZZ()  # create 
mzz.save()   # save()

o = organization()
o.save()

m.organization.add(o)  # add(o)

https://docs.djangoproject.com/en/dev/topics/db/examples/many_to_many/

Leave a comment