MultiValueDictKeyError в crud

def editproduct(request,pk): #editproduct/4 pk=4 prod=Item.objects.get(id=pk)

if request.method=='POST':
    if len(request.FILES)!=0:
        os.remove(prod.image.path)
    prod.image=request.FILES['image']
    prod.name=request.POST.get('name') #iphone
    prod.description=request.POST.get('description') #offers
    prod.price=request.POST.get('price') #200000
    prod.save()
    return redirect(index1)

context={'prod':prod}
return render(request,'edit_item.html',context)
Вернуться на верх