title: Not able to send checkbox data from all pagination in datatable from template to view in django
body: <p>I have a datatable in my django template in which there is a checkbox next to every row to send the row data to a view function to make some mass updations in django model. But problem is if the multiple rows are on the same page in pagination then i can send the data accurately BUT if i select row 2 from page 1 and row 5 from page 3 only the row value from page 3 will be sent to the view function.!</p>
  
  <p>TEMPLATE.HTML</p>
  
  <pre><code>{% block jquery %}
  &lt;script type="text/javascript" class="init"&gt;
      $(document).ready( function ($) {
          var $submit = $("#updiv").hide(),
              $cbs = $('input[name="updelegate"]').click(function() {
                  $submit.toggle( $cbs.is(":checked") );
              });
         $('#myTable').DataTable({
              dom: 'lBfrtip',
              "pageLength": 1,
              "language": {
                "emptyTable": "No Delegates Available",
                "sSearch": "Search Delegates: ",
                "info": " Showing _START_-_END_ out of Total _TOTAL_ Delegates",
  
              }
          });
      });
  
  
  
  &lt;/script&gt;
  {% endblock %}
  &lt;form id="myForm" action="{% url 'mass-delegates' %}" method="POST"&gt;
                          {% csrf_token %}
                          &lt;table id="myTable" class="table table-striped table-bordered" style="width:100%"&gt;
                              &lt;thead class="thead-dark"&gt;
                              &lt;tr&gt;
                                  &lt;th&gt;&lt;/th&gt;
                                  &lt;th scope="col"&gt;#&lt;/th&gt;
                                  &lt;th scope="col"&gt;Name&lt;/th&gt;
                                  &lt;th scope="col"&gt;Email&lt;/th&gt;
                                  &lt;th scope="col"&gt;Phone&lt;/th&gt;
                                  &lt;th scope="col"&gt;Company&lt;/th&gt;
                                  &lt;th scope="col"&gt;Designation&lt;/th&gt;
                                  &lt;th scope="col"&gt;Address&lt;/th&gt;
                                  &lt;th scope="col"&gt;City&lt;/th&gt;
                                  &lt;th&gt;&lt;/th&gt;
                                  &lt;th&gt;&lt;/th&gt;
                              &lt;/tr&gt;
                              &lt;/thead&gt;
                              &lt;tbody&gt;
                              {% for del in delegates %}
                              &lt;tr&gt;
                                  &lt;td&gt;
                                      &lt;label class="container"&gt;
                                          &lt;input type="checkbox" id="updelegate" name="updelegate"
                                                 value="{{ del.id }}"&gt;
                                          &lt;span class="checkmark"&gt;&lt;/span&gt;
                                      &lt;/label&gt;
                                  &lt;/td&gt;
                                  &lt;td&gt;{{ del.id }}&lt;/td&gt;
                                  &lt;td&gt;{{ del.first_name }} {{ del.last_name }}&lt;/td&gt;
                                  &lt;td&gt;{{ del.email }}&lt;/td&gt;
                                  &lt;td&gt;{{ del.phone }}&lt;/td&gt;
                                  &lt;td&gt;{{ del.company }}&lt;/td&gt;
                                  &lt;td&gt;{{ del.designation }}&lt;/td&gt;
                                  &lt;td&gt;{{ del.address }}&lt;/td&gt;
                                  &lt;td&gt;{{ del.city }} ({{ del.pincode }})&lt;/td&gt;
                                  &lt;td&gt;
                                      &lt;a href="{% url 'delegate' dataset_id=del.dataset_id %}"&gt;View&lt;/a&gt;
                                  &lt;/td&gt;
                                  &lt;td&gt;
                                      &lt;a href="{% url 'edit-delegate' id=del.id %}"&gt;Edit&lt;/a&gt;
                                  &lt;/td&gt;
                              &lt;/tr&gt;
                              {% endfor %}
                              &lt;/tbody&gt;
                          &lt;/table&gt;
                          &lt;div id="updiv"&gt;
                              &lt;select name="eventid"&gt;
                                  {% for ev in events %}
                                  &lt;option value="{{ ev.id }}"&gt;{{ ev.name }}&lt;/option&gt;
                                  {% endfor %}
                              &lt;/select&gt;
                              &lt;input type="submit" onclick="return confirm('Confirm Adding to Event?');" class="upbtn"
                                     name="update" value="Add to Event"/&gt;
                          &lt;/div&gt;
                      &lt;/form&gt;
  </code></pre>
  
  <p>VIEW.PY</p>
  
  <pre><code>def mass_delegates(request):
      if request.method == 'POST':
          toupdate = request.POST.getlist('updelegate')
          eventid = request.POST.get('eventid')
          array_length = len(toupdate)
          for i in range(array_length):
              if not EventDelegate.objects.filter(event_id=eventid, delegate_id=toupdate[i]).exists():
                  EventDelegate.objects.create(event_id=eventid, delegate_id=toupdate[i])
  
          return event_det(request, eventid)
  </code></pre>