title: How to use for loops in Django to create a table
body: <p>I am a beginner at Django and I am attempting to create a custom table using a html template called <code>law.html</code>. Within <code>law.html</code> I have the following code.</p>
  
  <pre><code>&lt;table class="table table-striped"&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Solicitor_Names&lt;/th&gt;
          &lt;th&gt;Offices&lt;/th&gt;
          &lt;th&gt;Addresses&lt;/th&gt;
          &lt;th&gt;Primary_Role&lt;/th&gt;
          &lt;th&gt;Secondary_Role&lt;/th&gt; 
          &lt;th&gt;Other_Role&lt;/th&gt;
          &lt;th&gt;Other_Role_1&lt;/th&gt;  
          &lt;th&gt;Other_Role_2&lt;/th&gt;
          &lt;th&gt;Other_Role_3&lt;/th&gt;
          &lt;th&gt;Other_Role_4&lt;/th&gt;        
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      {% for name in all_data.Solicitor_Name %} 
      &lt;tr&gt;
          &lt;td&gt;{{ name }}&lt;/td&gt;
      &lt;tr&gt;
      {% endfor %}
      {% for office in all_data.Office %} 
      &lt;tr&gt;
          &lt;td&gt;{{ office }}&lt;/td&gt;
      &lt;tr&gt;
      {% endfor %}
  &lt;/tbody&gt;
  </code></pre>
  
  <p></p>
  
  <p>The output produces the desired table headings perfectly. Also, the <code>Solicitor_Name</code> column is filled with the desired data. However, I fail in my attempt to place the <code>Office</code> data in the next column. Instead, the data continues to populate the cells under the <code>Solicitor_Name</code> column. How do I format the code so that I can get my desired output that looks like this?</p>
  
  <pre><code>Solicitor_Name   Offices   Address
  John            Orange LLP  123 Main St
  Bill            Apple LLP   124 Bone St
  </code></pre>
  
  <p>here is my views.py</p>
  
  <pre><code>def law_view(request, *args, **kwargs):
   all_data = combine_data()
   return render(request, "law.html", {'all_data': all_data})
  </code></pre>