title: Django template table
body: <p>I have 3 dictionaries data['d1'], data['d2'] and data['d3'].</p>
  
  <p>What i want is the table to look like this, getting the keys from each dictionary and presenting them like:</p>
  
  <pre><code>Team 1        |   Team 2       |   Team 3
  key 1 from d1 |  key 1 from d2 |  key 1 from d3
  key 2 from d1 |  key 2 from d2 |  key 2 from d3
  key 3 from d1 |  key 3 from d2 |  key 3 from d3
  key 4 from d1 |  key 4 from d2 |  key 4 from d3
  </code></pre>
  
  <p>What i have tryed</p>
  
  <pre><code>&lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Team 1&lt;/th&gt;
          &lt;th&gt;Team 2&lt;/th&gt;
          &lt;th&gt;Team 3&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
      {% for key, value in d1.items %}
          &lt;td&gt;{{ key }}&lt;/td&gt;
      {% endfor %}
      &lt;/tr&gt;
      &lt;tr&gt;
      {% for key, value in d2.items %}
          &lt;td&gt;{{ key }}&lt;/td&gt;
      {% endfor %}
      &lt;/tr&gt;
      &lt;tr&gt;
      {% for key, value in d3.items %}
          &lt;td&gt;{{ key }}&lt;/td&gt;
      {% endfor %}
      &lt;/tr&gt;
  &lt;/tbody&gt;
  </code></pre>
  
  <p>or </p>
  
  <pre><code>&lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Team 1&lt;/th&gt;
          &lt;th&gt;Team 2&lt;/th&gt;
          &lt;th&gt;Team 3&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      {% for key, value in d1.items %}
      &lt;tr&gt;
          &lt;td&gt;{{ key }}&lt;/td&gt;
      &lt;/tr&gt;
      {% endfor %}
      {% for key, value in d2.items %}
      &lt;tr&gt;
          &lt;td&gt;{{ key }}&lt;/td&gt;
      &lt;/tr&gt;
      {% endfor %}
      {% for key, value in d3.items %}
      &lt;tr&gt;
          &lt;td&gt;{{ key }}&lt;/td&gt;
      &lt;/tr&gt;
      {% endfor %}
  &lt;/tbody&gt;
  </code></pre>
  
  <p>but it's showing them differently. How can i achieve the above table?</p>
  
  <p>Current table is displayed like this:</p>
  
  <pre><code>Stalone Sobont  arda    AAA
  Sardina Jhonny  Lala    Vali
  LilJon  Scuipy  SSS     Mazare
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code>stats = data['scoruri'].copy()
      data['d1'] = {}
      data['d2'] = {}
      data['d3'] = {}
  
  for key, value in stats.copy().items():
      if not data['d1'] or sum(data['d1'].values()) &lt;= sum(data['d2'].values()) and \
                           sum(data['d1'].values()) &lt;= sum(data['d3'].values()):
          name, score = max(stats.items(), key=lambda p: p[1])
          data['d1'][name] = score
          stats.pop(name, score)
          data['total_1'] = sum(data['d1'].values())
      elif not data['d2'] or sum(data['d2'].values()) &lt;= sum(data['d1'].values()) and \
                             sum(data['d2'].values()) &lt;= sum(data['d3'].values()):
          name, score = max(stats.items(), key=lambda p: p[1])
          data['d2'][name] = score
          stats.pop(name, score)
          data['total_2'] = sum(data['d2'].values())
      elif not data['d3'] or sum(data['d3'].values()) &lt;= sum(data['d1'].values()) and \
                             sum(data['d3'].values()) &lt;= sum(data['d2'].values()):
          name, score = max(stats.items(), key=lambda p: p[1])
          data['d3'][name] = score
          stats.pop(name, score)
          data['total_3'] = sum(data['d3'].values())
  </code></pre>