色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

您的位置:首頁技術(shù)文章
文章詳情頁

python+jinja2編寫前端界面,發(fā)生Unexpected end of template問題,求解決!

瀏覽:91日期:2022-06-30 09:03:55

問題描述

<!DOCTYPE html ><html><head><title>{{title}}</title>

<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>

<meta name='viewport' content='width=device-width, initial-scale=1.0'>

<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.c... integrity='sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7' crossorigin='anonymous'>

<style>table{

border:0;border-collapse:collapse;}

td{

font:normal 12px/17px Arial;padding:2px;width:100px;}

th{

font:bold 12px/17px Arial;text-align:left;padding:4px;border-bottom:1px solid #333;width:100px;}

.parent{

background:#FFF38F;cursor:pointer;} /* 偶數(shù)行樣式*/

.odd{

background:#FFFFEE;} /* 奇數(shù)行樣式*/

.selected{

background:#FF6500;color:#fff;}

</style></head>

<body>

<p class='container'>

<p class='row'> <p class='col-xs-12'><h2 class='text-capitalize'>{{title}}</h2> <p class=’attribute’><strong></strong></p> </p></p><p class='row'> <p class='col-xs-12 col-sm-10 col-md-10'>

<thead> <tr><!--{% for n in list %}--><!--<th>{{ n[’suite’] }}</th>--><!--<th>Status</th>--><th>Suite</th><th>Status</th> </tr> </thead> <tbody> <tr id='row_01'> {% for n in list %} <td>{{ n[’suite’] }}</td> <td>Status</td> </tr> <!--<tr class=’{{status}}’>--> <!--<tr class=’{{status}}’ id=’row_02’>--> <tr class=’child_row_01’ > {% for i in n[’suitecase’] %} {% for a in i %} <td class='col-xs-9'>{{ a[’tag’] }}--{{ a[’action’] }}--{{ a[’element’] }}</td> <td class='col-xs-3'> <span class='label label-{{a[’status’]}}'> {% if 'success' in a[’status’] %} Pass {% elif 'info' in a[’status’] %} Skip {% elif 'danger' in a[’status’]%} Fail {% else %}Error {% endif %} </span> {% if 'success' not in a[’status’] %} &nbsp<button class='btn btn-default btn-xs'>View</button> {% endif %} </td> {% if 'success' not in a[’status’] %} <tr style='display:none;'> <td class='col-xs-9'> </td> </tr> {% endif %}

{% endfor %}

{% endfor %} {% endfor %}

<tr><td> Total Test Runned:{{total_test}} </td><td class='row'><span class='col-xs-3'></span>

</td> </tr>

</tbody>

</p> </p></p>

<script src='https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js'></script><script src='http://www.codefans.net/ajaxjs/jquery1.3.2.js' ></script><script type='text/javascript'> $(function(){ $(’tr.parent’).click(function(){ // 獲取所謂的父行 $(this) .toggleClass('selected') // 添加/刪除高亮 .siblings(’.child_’+this.id).toggle(); // 隱藏/顯示所謂的子行 }); }) $(document).ready(function(){$(’td’).on(’click’, ’.btn’, function(e){ e.preventDefault(); var $this = $(this); var $nextRow = $this.closest(’tr’).next(’tr’); $nextRow.slideToggle('fast'); $this.text(function(i, text){if (text === ’View’) { return ’Hide’;} else { return ’View’;}; });}); });

</script>

</body>

</html>將這個(gè)前端模板渲染,提示這個(gè)錯(cuò)誤jinja2.exceptions.TemplateSyntaxError: Unexpected end of template. Jinja was looking for the following tags: ’endfor’ or ’else’. The innermost block that needs to be closed is ’for’.

問題解答

回答1:

for 總共四個(gè),endfor總共三個(gè),所以樓主應(yīng)該寫少一個(gè)endfor吧,所以導(dǎo)致語法錯(cuò)誤!

標(biāo)簽: Python 編程
主站蜘蛛池模板: 精品欧美日韩一区二区三区 | 国产韩国精品一区二区三区 | 国产综合第一页 | 国产成人精品男人的天堂538 | 中国国语毛片免费观看视频 | 99在线小视频| 色老汉丁香网 | 久久91精品国产91久久跳舞 | 欧美在线亚洲国产免m观看 欧美在线一级精品 | 久久久亚洲欧洲日产国码二区 | 韩国一级黄色毛片 | 高清日本无a区 | 国产精品国产三级国产an不卡 | 亚洲最大激情中文字幕 | 在线看片不卡 | 毛片网站观看 | 国产中文字幕在线观看 | 99国产精品免费视频观看 | 夜色视频一区二区三区 | 中文在线最新版天堂 | 亚洲成a人片在线看 | 波野多结衣在线观看 | 久久久香蕉 | 国产精品特级毛片一区二区三区 | 国产精品国产三级国产在线观看 | 中文在线日韩 | 国产高清一 | 精品在线一区二区三区 | 欧美激情国产一区在线不卡 | 日韩欧美在线视频观看 | 一级毛片子| 欧美日韩一本 | 免费一级特黄a | 亚洲国产三级在线观看 | 精品无码久久久久久国产 | yy6080午夜国产免费福利 | 正在播放国产一区 | 亚洲第一成人天堂第一 | 一本色道久久爱88av | 亚洲永久免费 | 免费国内精品久久久久影院 |