【发布时间】:2014-02-21 21:11:06
【问题描述】:
使用 Django Rest Framework 我正在尝试使用图像字段更新模型。当我尝试更新模型上的其他字段时,我收到此错误:
{"image": ["No file was submitted. Check the encoding type on the form."]}
这是序列化程序的简单概念。它在 GET 调用中返回的图像字段只有文件名。
class ModelWithImageSerializer(serializers.ModelSerializer):
image = serializers.ImageField('image', required=False)
class Meta:
model = models.Level
fields = ('id','name', 'image')
如何在不重新提交文件的情况下更新我的模型?
【问题讨论】:
标签: django django-rest-framework