[Fixed]-Issues with intermediary many to many field in Django

1👍

It’s not possible to use add() when using an intermediary model, because that wouldn’t let you specify values for the extra fields on the intermediary model.

Instead, just create an instance of the intermediary model.

OrgMapping.objects.create(
    venue=venue,
    org_user=user,
    # set all the other required OrgMapping fields here
)

See the docs on extra fields on many-to-many relationships for more info.

Leave a comment