此UserProfile模型包含一个ForeignKey字段。在表单中,我想使用ModelChoiceField预填充表单域。每当我提交表单时,我都会收到Cannot assign "'13'": "UserProfile.course" must be ablank=True)
picture = models.ImageField(upload_to=&
class Product(models.Model): product_name = models.CharField(max_lengthdefault=timezone.now)
return self.product_name or u''
当我使用form将来自前端的所有数据保存到我的数据库中时product_image','produ