def mymethod(request):
return_obj = {}
if request.method == 'POST':
info = request.POST
try:
ts_vals, coordinates, name = somefunction(params)
return_obj["values"] = ts_vals
return_obj["msg"] = candy.translated(request, "all_msg") # all_msg is from the excel
return_obj["name"] = name
return_obj["success"] = "success"
except Exception as e:
return_obj["error"] = candy.translated(request, "all_Error")
return JsonResponse(return_obj)
我试过上面的过程。返回的 JSON 在我的 javascript 代码中解析并从 javascript 代码发送回接口。我们如何使用 Candy Translation 处理这种情况?