像这样的代码(上传图片时执行):
gallery = Gallery.objects.get(id=album_id)
index = gallery.photo_num +1 #index will be used in later
gallery.photo_num = index
gallery.save()
1张图片上传效果很好,但如果同时上传多张图片,使用多张上传jQuery plugin.the "gallery.photo_num“会比较混乱
如何修改代码以避免此问题
我在后端使用django rest框架(版本3.12.2),在前端使用React/Next js。
我的目标很简单,我想上传图片到photo_main字段。
不幸的是,当我试图上传svg图像时,我收到了一条错误消息(png、jpg和jpeg正在正常工作)。
错误消息
{"photo_main":["Upload a valid image. The file you uploaded was either not an image or a corrupted image."]}
模型
class Recipe(models.Model):
id = m