Django ModelForm Imagefield Upload

后端 未结 2 640
旧时难觅i
旧时难觅i 2021-02-02 12:11

I am pretty new to Django and I met a problem in handling image upload using ModelForm. My model is as following:

class Project(models.Model):
    name = models.         


        
2条回答
  •  情深已故
    2021-02-02 12:44

    OK, thanks everyone. I found myself made a stupid mistake. I should add enctype="multipart/form-data" in the

    Else, it won't upload the file.

提交回复
热议问题