我正在开发一个 django 应用程序,在该应用程序中,我试图通过 javascript 单击按钮将变量的值发送到后端。
javascript代码:
$(document).on("click", "#filter", function (e) {
IUPredscorethreshold = 0.4
$("#ksNetwork").empty();
ksInteractionNetwork('{% url "camkinetv2:newinteractors_intnet" tab1.caMKipedia_Id IUPredscorethreshold %}');
});
网址.py
path(
"dataJson/newinteractors_intnet/<str:geneId>/<str:IUPredscorethreshold>",
views.newinteractors_intnet,
name="newinteractors_intnet",
),
视图.py
@csrf_exempt
def newinteractors_intnet(request, geneId, IUPredscorethreshold):
print("IUPredscorethreshold:" + IUPredscorethreshold)
.
.
.
.
.
some computation
graphData = {"nodes": uniquenodesdata, "links": linksdata}
response = JsonResponse(graphData)
return response
当我执行此代码时,我收到以下错误:
NoReverseMatch at /v2/search/SARS_CoV_2/GID1716
Reverse for 'newinteractors_intnet' with arguments '('GID1716', '')' not found. 1 pattern(s) tried: ['v2/dataJson/newinteractors_intnet/(?P<geneId>[^/]+)/(?P<IUPredscorethreshold>[^/]+)$']
Exception Value:
Reverse for 'newinteractors_intnet' with arguments '('GID1716', '')' not found. 1 pattern(s) tried: ['v2/dataJson/newinteractors_intnet/(?P<geneId>[^/]+)/(?P<IUPredscorethreshold>[^/]+)$']
我究竟做错了什么?我该如何解决这个问题。我仍处于 django 的学习阶段,我无法弄清楚如何解决这个错误。
哔哔one
守候你守候我
慕森卡
相关分类