title: How to create unknown numbers of HTML tables
body: <p>I am trying to render a table using Django-Python. Let us say I have a record of last names starting from A-Z. Now, I want to create a table based on each letter, and put all the people with that first-letter last name on their own table. </p>
  
  <pre><code>EX:
  TABLE A Last names
    Adams
    Anderson
  
  TABLE B Last names
    Barnes
    Bill
    Brandon 
  
  TABLE J Last names
    Jackson
    Johnson 
  
  etc….   ## this is the output I want to achieve
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>  &lt;legend&gt;Customers&lt;/legend&gt;    
      &lt;table&gt;
        &lt;tr&gt;
          &lt;th&gt;First Name&lt;/th&gt;
          &lt;th&gt;Last Name&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
        {% for idx in people %}
          &lt;td&gt;{{ idx.0 }}&lt;/td&gt;
          &lt;td&gt;{{ idx.1 }}&lt;/td&gt;
        &lt;/tr&gt;
        {% endfor %}
      &lt;/table&gt;
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code>def index(request):
      context = {
          "people": People.objects.all()
      }
      return render(request, 'index.html', context)
  </code></pre>
  
  <p>I can easily render this. However, I am trying to separate everyone based on their last name by creating as many as 26 tables. I want them to all appear in the same html page, but separated by tables accordingly. I don’t know how many letters I have from the database and I am trying to avoid hard-coding a table with A-Z header. This is because in my app, it is possible that out of 26, I only have 5 letters available. For looping in the html using the {% tags %} are very helpful.</p>
  
  <p>I have been trying to create a table inside of a loop in html but I'm getting funny results. Can anyone please help me out? </p>
  
  <p>Thank you very much!</p>