def updateProduct(request): pc=request.GET.get('pro_category_name') i=Products.objects.get(pro_category_name=pc) f=productform(request.GET,instance=i) f.save() return redirect('/productlist.html')
def addproductdb(request): pd=productform(request.POST,request.FILES) pd.save() return redirect('/addproduct.html')
def editproduct(request): k=request.GET.get('id') i=Products.objects.get(id=k) p=productform(instance=i) return render(request,'editproduct.html',{'form':p,'id':id})
def addproduct(request): c1 = Category.objects.all() b=productform() return render(request,'addproduct.html',{'product':b,'c1':c1})