oscarmlage / django-cruds-adminlte

django-cruds is simple drop-in django app that creates CRUD for faster prototyping
BSD 3-Clause "New" or "Revised" License
424 stars 81 forks source link

Many-to-Many fields are not saved in inline forms #136

Open benmaier opened 4 years ago

benmaier commented 4 years ago

When editing a many-to-many-field in an inline form, the entries are not saved. The reason that this happens is that in inline_cruds.py, the form is called via

object = form.save(commit=False)

due to the commit=False, many-to-many fields will not be saved when object.save() is called.

To fix this, call form.save_m2m() after object.save() in inline_cruds.py