如何从Django arraymodelfield中的表单中插入值

时间:2018-09-17 11:44:32

标签: python django mongodb django-models djongo

这是我的模特

 class Product(models.Model):
     name = models.CharField(max_length=255)
     image = models.ImageField(upload_to='', blank=True)
     image1 =models.ArrayModelField(
         model_container=Images1,
         model_form_class=Images1Form
     )

这是我的HTML代码。提交时无效:

                                                                                                              商品编号1(必填)                                                                                                                                                                                                                                                                                                  商品编号2(可选)                                                                                                                                                                                                                        

帮我,我欢迎任何建议。 当我使用数组字段时,它会显示一个值。它必须是一个列表,并且我使用if条件来验证保存,否则使用它来返回缺少的字段。

0 个答案:

没有答案