'的QueryDict'对象没有属性'文件'

时间:2016-07-18 12:00:56

标签: django python-2.7

我正在尝试更新包含表单中图像字段的模型,如下所示 在我的 views.py:

if request.method == "POST" and 'submit_business' in request.POST:
    id = request.POST.get('update_business')
    for object in Object.objects.filter(id=id):
        object.photo = request.FILES.get('photo')
        object.save()

它会抛出错误:'QueryDict' object has no attribute 'FILES' \

0 个答案:

没有答案