I have a problem saving many to many fields from a form. Here are my models:
class TextIssue(models.Model):
Issue = models.CharField(max_length=150, uniq
You can do like this for example:
if todo_list_form.is_valid():
todo_list = todo_list_form.save(commit=False)
todo_list.save()
todo_list_form.save_m2m()
http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#the-save-method
When using commit=False
, you have to call save_m2m()
m2m relationships require the parent object to be saved first, which you are not doing by using commit=False