Add an object by id in a ManyToMany relation in Django
Add an object by id in a ManyToMany relation in Django Question: Django’s ManyToMany field can be populated using my_field.add(my_instance), but as I understand it only my_instance.id is actually needed to perform the corresponding SQL query. If I want to add an object by its id, I can use my_field.add(MyModel.objects.get(id=id)), but this will generate two …