Nested For Loop in Jinja2

后端 未结 1 1079
再見小時候
再見小時候 2020-12-18 09:02

I am making a nested for loop in Jinja / Python Flask.

If I hard code the values, then it works fine. Am I missing something in the Jinja template?

         


        
相关标签:
1条回答
  • 2020-12-18 09:53

    Figured it out...

    <table class="table table-striped">
    <tr>
        {% for column in Columns %}
            <td>{{ column }}</td>
        {% endfor %}
    </tr>
    
           {% for row in rows %}
               <tr>
                    {% for column in Columns %}
                        <td>{{ row[column] }}</td>
                    {% endfor %}
               </tr>
           {% endfor %}
    
    </table>
    
    0 讨论(0)
提交回复
热议问题