def setItemGrade(request): d = request.REQUEST data = json.loads(d['data']) result = Anlysis.judgeItem(data) #for comm in result["bad"]: #print comm; item = Item(itemId=data["id"], grade=result["grade"], rid=0) if (data["quick"]): item["hasComment"] = False item["goodComment"] = [] item["badComment"] = [] else: item["hasComment"] = True item["goodComment"] = result["good"] item["badComment"] = result["bad"] item.save() return HttpResponse( json.dumps({ "status": "success", "grade": item.grade, "goodComment": item.goodComment, "badComment": item.badComment }))
def setShopGrade(request): d = request.REQUEST data = json.loads(d['data']) print data result = Anlysis.judgeShop(data) shop = Shop(shopId=data["id"], grade=result["grade"], rid=result["rid"]) # print shop["shopId"] shop.save() return HttpResponse(json.dumps({"status": "success", "grade": shop.grade}))
def setShopGrade(request): d = request.REQUEST data = json.loads(d['data']) print data result = Anlysis.judgeShop(data) shop = Shop(shopId = data["id"], grade = result["grade"], rid = result["rid"]) # print shop["shopId"] shop.save() return HttpResponse(json.dumps({"status": "success", "grade": shop.grade}))
def setItemGrade(request): d = request.REQUEST data = json.loads(d['data']) result = Anlysis.judgeItem(data) #for comm in result["bad"]: #print comm; item = Item(itemId = data["id"], grade = result["grade"], rid = 0) if (data["quick"]): item["hasComment"] = False item["goodComment"] = [] item["badComment"] = [] else: item["hasComment"] = True item["goodComment"] = result["good"] item["badComment"] = result["bad"] item.save() return HttpResponse(json.dumps({"status": "success", "grade": item.grade, "goodComment": item.goodComment, "badComment": item.badComment}))