title: Jinja2: Dynamically copying nested array/dictionary into HTML table row
body: <p>I've been working on dynamically creating an event table for an application I'm working on.  I'm trying to fill in the rows dynamically using Jinja2 template logic. I'm using flask for the routing, and pure.css for the basic css stuff.</p>
  
  <p>My data is organized as follows:</p>
  
  <pre><code>event_data{ device_name:[ {'summary':"", ... 'severity'},
                            {'summary':"", ... 'severity'},
                             .
                             .
                             .   ]
              device_name:[ ... ] }
  </code></pre>
  
  <p>My template code:</p>
  
  <pre><code>    &lt;div style="overflow:auto; height:150px; width:auto; border:1px solid; margin:20px;"&gt;
          &lt;table class="pure-table"&gt;
              &lt;thead&gt;
                  &lt;tr&gt;
                      &lt;th&gt;Name&lt;/th&gt;
                      &lt;th style="width:30%;"&gt;Summary&lt;/th&gt;
                      &lt;th&gt;Last Seen&lt;/th&gt;
                      &lt;th&gt;First Seen&lt;/th&gt;
                      &lt;th&gt;Device Priority&lt;/th&gt;
                      &lt;th&gt;Event Class&lt;/th&gt;
                      &lt;th&gt;Production State&lt;/th&gt;
                      &lt;th&gt;Severity&lt;/th&gt;
                  &lt;/tr&gt;
              &lt;/thead&gt;
              &lt;tbody&gt;
                  {% for device in event_data %}
                      {% for event in event_data[device]%}
                          &lt;tr&gt;
                              &lt;td&gt;hello&lt;/td&gt;
                              &lt;td&gt;{{ event['summary'] }}&lt;/td&gt;
                              &lt;td&gt;{{ event['lastTime'] }}&lt;/td&gt;
                              &lt;td&gt;{{ event['firstTime'] }}&lt;/td&gt;
                              &lt;td&gt;{{ event['DevicePriority'] }}&lt;/td&gt;
                              &lt;td&gt;{{ event['eventClass'] }}&lt;/td&gt;
                              &lt;td&gt;{{ event['prodState'] }}&lt;/td&gt;
                              &lt;td&gt;{{ event['severity'] }}&lt;/td&gt;
                          &lt;/tr&gt;
                      {%endfor%}
                  {% endfor %}
              &lt;/tbody&gt;
         &lt;/table&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>I'm getting the information to my page with this call from Flask:</p>
  
  <pre><code>return render_template('app_page.html', event_data=json.dumps(event_data), device_names=devices)
  </code></pre>
  
  <p>I tested the equivalent python loop and it printed the information perfectly fine. When I run it like this it doesn't even enter the inner loop, so it doesn't make any new rows past the header row. Any advice or suggestions are very welcome!</p>