Exemple #1
0
def FChange_Item(request):
	context = {"url":blobstore.create_upload_url('/admin/item_change')}
	goodID = None
	data = None
	done = False
	img1 = None
	img2 = None
	if request.method == 'POST':
		id_form = Goods_ID_Form(request.POST)
		form=Goods_Form(request.POST)
	
		if id_form.is_valid() and form.is_valid():
			data= form.cleaned_data
			goodID = id_form.cleaned_data['goods_id']
			if "image1" in request.FILES:
				img1=get_uploads2(request,"image1")
				
			if "image2" in request.FILES:
				img2=get_uploads2(request,"image2")
			
			done = Product_Change(goodID, data['type_id'], data['goods_name'], data['goods_cost'], data['introduction1'], data['Ingredient'],
								data['Manual'], data['enable'], data['sp'], data['new'], img1, img2)
			
			
		context['name'] = data['goods_name']
		context['type'] = data['type_id']
		context['goodID'] = goodID
		context['success'] = done

	return HttpResponse(json.dumps(context), content_type="application/json")
Exemple #2
0
def FItem_Delete(request):
	done = None
	if request.method == 'POST':
		id_form = Goods_ID_Form(request.POST)
		if id_form.is_valid():
			done = Item_Delete(id_form.cleaned_data['goods_id'])
				
	return HttpResponsePermanentRedirect("/")