鑑於這種模式Django的表單文件字段沒有設置爲無,如果沒有文件上傳
class ScrapbookItem(models.Model):
scrapbook = models.ForeignKey(Scrapbook)
photo = models.ImageField(upload_to="uploads/scrapbook", blank=True, null=True, default=None)
comment = models.TextField(null=True, blank=True)
class ScrapbookItemDesignIdeaForm(forms.ModelForm):
class Meta:
model = ScrapbookItem
fields = ['scrapbook', 'comment']
當我提交表單,照片字段沒有被設置爲無,那爲什麼會是什麼?
這是什麼設置? – 2013-02-17 20:17:05
它被設置爲空,但我希望它是無。 – 2013-02-18 00:08:33