Saving Many To Many data via a modelform in Django

后端 未结 2 1395
刺人心
刺人心 2020-11-30 02:06

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         


        
2条回答
  •  天涯浪人
    2020-11-30 02:39

    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

提交回复
热议问题