title: How can I break my html table up into chunks django python
body: <p>So for example I have a table with 3 rows and 100 columns. What I would like to do is split it up by tens so the first table has 3 rows then 10 columns and so on until I have 10 tables all with equal 3 rows and 10 columns. The catch is I dont want repeats so in table one it should be 1-10 then table 2 it should be 11-20 and so on and so on...</p>
  
  <p>Any help would be greatly appreciated. I would like to do this using a python way and not css. </p>
  
  <p>Here is my view. </p>
  
  <pre><code>@login_required
  def shipping_pdf(request, id):
    sheet_data = Sheet.objects.get(pk=id)
    work_order = sheet_data.work_order
    purchase_order = sheet_data.purchase_order
    drawing = sheet_data.drawing_number
    draw_rev = sheet_data.drawing_revision
    part = sheet_data.part_number
    part_rev = sheet_data.part_revision
    customer_data = Customer.objects.get(id=sheet_data.customer_id)
    customer_name = customer_data.customer_name 
    title_head = 'Shipping-%s' % sheet_data.work_order
    complete_data = Sheet.objects.raw("""select s.id, d.id d_id, s.work_order, d.target, i.reading, d.description, i.serial_number from app_sheet s left join app_dimension d on s.id = d.sheet_id
    left join app_inspection_vals i on d.id = i.dimension_id where s.id = %s""" % id)
  
    for c_d in complete_data:
      dim_description = Dimension.objects.filter(sheet_id=c_d.id).values_list('description', flat=True).distinct()
  
      dim_id = Dimension.objects.filter(sheet_id=c_d.id)[:1]
      for d_i in dim_id:
        dim_data = Inspection_vals.objects.filter(dimension_id=d_i.id)
        reading_data = Inspection_vals.objects.filter(dimension_id=d_i.id)      
  
    key_list = []
    vals_list = []
  
    for xr in complete_data:
  
      key_list.append(xr.description)
      vals_list.append(xr.reading)
  
      #print reading_desc
      sample_size = dim_data  
    reading_desc = {} 
    for i in range(len(key_list)):
      if key_list[i] in reading_desc:
        reading_desc[key_list[i]].append(vals_list[i])
      else: 
        reading_desc[key_list[i]]=[vals_list[i]]
  
        print reading_desc
    return render_to_pdf(
       'app/shipping_pdf.html',  
       {
         'work_order': work_order, 
         'sample_size': sample_size,
         'customer_name': customer_name,
         'title': title_head, 
         'reading_desc': reading_desc, 
         'purchase_order': purchase_order,
         'drawing': drawing,
         'draw_rev': draw_rev,
         'part': part,
         'part_rev': part_rev,
  
      }                     
    )
  </code></pre>
  
  <p>here is my html.</p>
  
  <pre><code>      &lt;table style="border: 2px solid black;"&gt;
          &lt;thead&gt;
          &lt;tr&gt;
            &lt;th&gt;Serial Number&lt;/th&gt;
            {% for ss in sample_size %}
               &lt;th&gt;{{ ss.serial_number }}&lt;/th&gt;
            {% endfor %}
          &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;tbody&gt;
             {% for key, values in reading_desc.items %}
             &lt;tr&gt; 
               &lt;td&gt;{{key}}&lt;/td&gt;
               {% for v in values %}
                 &lt;td&gt;{{v}}&lt;/td&gt;
               {% endfor %}
            &lt;/tr&gt;
             {% endfor %}
          &lt;/tbody&gt; 
        &lt;/table&gt;
  </code></pre>
  
  <p>Here is what it looks like now *notice its all squished. </p>
  
  <p><a href="https://i.stack.imgur.com/7C0i5.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7C0i5.jpg" alt="Before"></a></p>
  
  <p>Here is what I would like it to look like.</p>
  
  <p><a href="https://i.stack.imgur.com/dGoAG.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dGoAG.jpg" alt="enter image description here"></a></p>
  
  <p>Tried a suggestion made still no luck now I have a new error </p>
  
  <pre><code>      &lt;table style="border: 2px solid black;"&gt;
          &lt;thead&gt;
          &lt;tr&gt;
            &lt;th&gt;Serial Number&lt;/th&gt;
            {% for ss in sample_size %}
               &lt;th&gt;{{ ss.serial_number }}&lt;/th&gt;
            {% endfor %}
          &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;tbody&gt;
             {% for i in range(10) %} 
               {% for j in range(100) %} 
                 {% for key, values in reading_desc.items.i*j %}
                 &lt;tr&gt; 
                   &lt;td&gt;{{key}}&lt;/td&gt;
                   {% for v in values %}
                     &lt;td&gt;{{v}}&lt;/td&gt;
                   {% endfor %}
                 &lt;/tr&gt;
                 {% endfor %}
               {% endfor %}
             {% endfor %}
          &lt;/tbody&gt; 
        &lt;/table&gt;
  </code></pre>
  
  <p>Could not parse the remainder: '(100)' from 'range(100)'</p>