示例#1
0
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')
示例#2
0
def addproductdb(request):
    pd=productform(request.POST,request.FILES)    
    pd.save()
    return redirect('/addproduct.html')
示例#3
0
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})
示例#4
0
def addproduct(request):
    c1 = Category.objects.all()
    b=productform()
    return render(request,'addproduct.html',{'product':b,'c1':c1})