title: Select objects with checkboxes in Class Based ListView
body: <p>I'm a django newbie, I'm making a little app to record work calls received during nighttime.
  At the moment the app works fine. I have made a form to fill call data, which is then presented as a table using a generic ListView.</p>
  
  <pre><code>class IndexView(LoginRequiredMixin, generic.ListView):
     login_url = '/login/'
     redirect_field_name = 'redirect_to'
     template_name = 'chiamate/list_full.html'
     context_name = 'lista_chiamate'
     def get_queryset(self):
         return Chiamata.objects.all
  </code></pre>
  
  <p>Here is the code for the template:</p>
  
  <pre><code>{% extends 'chiamate/base.html' %}
  
  {% block content %}
  
  {% if user.is_authenticated %}
      &lt;a href="{% url "chiamate:inserimento chiamata" %}" class="btn btn-success"&gt;&lt;i class="fa fa-plus-square-o fa-lg" aria-hidden="true"&gt;&lt;/i&gt; Nuova Chiamata&lt;/a&gt;
  &lt;p&gt;&lt;/p&gt;
  {% else %}
      &lt;p&gt;Welcome, Guest please &lt;a href="{% url 'login' %}"&gt;[login]&lt;/a&gt;&lt;/p&gt;
  {% endif %}
  
      &lt;div class="table-responsive"&gt;
      &lt;table class="table table-striped"&gt;
          &lt;form action="{{ action }}" method="post"&gt;
              {% csrf_token %}
      {% for chiamata in object_list %}
          {% if chiamata.data_chiusura.weekday == 4 or chiamata.data_chiusura.weekday == 5 or chiamata.data_chiusura.weekday == 6 %}
              &lt;tr class="info"&gt;
          {% elif chiamata.data_chiusura == None  %}
              &lt;tr class="danger"&gt;
          {% else %}
              &lt;tr&gt;
          {% endif %}
                  &lt;td&gt;&lt;input class="checkbox" name="chiamata_mail" type="checkbox" id="checkbox_{{ chiamata.id }}"value="{{ chiamata.id }}"&gt;&lt;/td&gt;
                  &lt;td class="txtdata"&gt;{{ chiamata.utente.get_full_name|wordwrap:5  }}&lt;/td&gt;
                  &lt;td class="txtdata"&gt;&lt;a href="{% url 'chiamate:dettaglio chiamata' chiamata.id %}"&gt;{{ chiamata.data_chiamata|date:"l d M Y H:i" }}&lt;/a&gt;&lt;/td&gt;
                  &lt;td&gt;{{ chiamata.interlocutore }}&lt;/td&gt;
                  &lt;td&gt;{{ chiamata.testo_chiamata|truncatechars:200 }}&lt;/td&gt;
                  &lt;td class="txtdata"&gt;{{ chiamata.reperibile|wordwrap:5 }}&lt;/td&gt;
                  &lt;td&gt;{{ chiamata.data_chiusura|date:"H:i" }}&lt;/td&gt;
                  &lt;td&gt;&lt;a href="{% url 'chiamate:modifica chiamata' pk=chiamata.id %}" class="btn btn-success" &gt;&lt;i class="fa fa-pencil-square-o fa-lg" aria-hidden="true"&gt;&lt;/i&gt; Edit&lt;/a&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;a href="{% url 'chiamate:cancella chiamata' pk=chiamata.id %}" class="btn btn-danger"&gt;&lt;i class="fa fa-trash-o fa-lg" aria-hidden="true"&gt;&lt;/i&gt; Delete&lt;/a&gt;&lt;/td&gt;
              &lt;/tr&gt;
          {% endfor %}
          &lt;input id="send_selected" type="submit" value="Send" /&gt;
      &lt;/form&gt;
      &lt;/table&gt;
      &lt;/dv&gt;
  {% endblock %}
  </code></pre>
  
  <p>I've already tried to add the checkboxes here. When I do, they show on the page but then when I press the send button (currently implemented as a form send, but I want to use a bootstrap button) I don't know how to pass the objects to the email function, or at least show them in a new page.</p>