在django中,我想通过将任何变量的值放入模板的标记值来处理{%url%}。你知道吗
pp_001.html文件
<script>
$('#dataTables-wkgrid tbody').on( 'click', 'tr', function () {
var data = table.row( this ).data();
if ( $(this).hasClass('selected') ) {
$(this).removeClass('selected');
}
else {
table.$('tr.selected').removeClass('selected');
$(this).addClass('selected');
$.ajax({
type: "GET",
url: "{% url 'pp_02_open' %}",
data : {
"cPp_no" : data.pp_no
},
dataType: "json",
cache: false,
success: function(result){
console.log(result) ;
var aTag = "" ;
$.each(result.filelist,function(index){
cDocName = result.filelist[index].doc_name ;
cFilename = result.filelist[index].file_name ;
cid = result.filelist[index].id ;
cpp_no = result.filelist[index].pp_no ;
aTag += '<a href="{% url "pp_02_download" id=cid %}" class="list-group-item">'
+'<i name="iText" class="fa fa-file-powerpoint-o fa-fw"></i>'+result.filelist[index].doc_name
+'<i name="file_downloads" class="pull-right glyphicon glyphicon-cloud-download style="padding-left:10px">다운로드</i>'
+'</span>'
+'</a>'
</script>
你知道吗网址.py你知道吗
path(r'^PP/download/<int:id>/$' , views_pp.download , name="pp_02_download"),
错误。。。。你知道吗
找不到关键字参数为“{id”:“'}”的“pp\u 02\u download”的反转。尝试了1个模式:['crms/^PP\/下载\/(?P[0-9]+)\/\$']
换句话说,当jsp脚本的变量值为 {%url“pp\u 02\u download id=cid%},我想知道怎么可能传递cid的值。你知道吗
如果用这种方式随机传递“10”而不是cid,它将正常执行。你知道吗
开发尚未完成。首先,它在参数中获取一个id值,检索数据,然后尝试下载文件。你知道吗
当前源配置为可以通过随意指定特定文件来检查下载是否正常。你知道吗
你知道吗视图.py你知道吗
更改为网址.py不起作用。你知道吗
NoReverseMatch at/crms/PP编号/ 找不到关键字参数为“{id”:“'}”的“pp\u 02\u download”的反转。已尝试1个模式:['crms/PP\/download\/(?P[0-9]+)\/$']
相关问题 更多 >
编程相关推荐