Beim Schreiben der Front-End-Schnittstelle in Python + Jinja2 tritt ein unerwartetes Ende der Vorlage auf. Bitte lösen Sie es!
ringa_lee
ringa_lee 2017-05-27 17:39:39
0
1
1346

<!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">

>

<style>

Tabelle{

border:0;
border-collapse:collapse;
}

td{

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

.{

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

.parent{

background:#FFF38F;
cursor:pointer;
}  /* 偶数行样式*/

.odd{

background:#FFFFEE;
}  /* 奇数行样式*/

.ausgewählt{

background:#FF6500;
color:#fff;
}

</style>

</head>


<Körper>

<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 class="parent" 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>

将这个前端模板渲染,提示这个错误

jinja2.Exceptions.TemplateSyntaxError: Unerwartetes Ende der Vorlage. Jinja suchte nach den folgenden Tags: „endfor“ oder „else“. Der innerste Block, der geschlossen werden muss, ist „für“.

ringa_lee
ringa_lee

ringa_lee

Antworte allen(1)
伊谢尔伦

for 总共四个,endfor总共三个,所以楼主应该写少一个endfor吧,所以导致语法错误!

Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage