title: Django checkbox question
body: <p>Hello I have a template form which displays a list of items. This template is called edit_order.html. I want to be able to add a new item from another list of items. From the other list of items is a template called items.html, showing a list of items. In items.html, each item has a checkbox besides an item. Now, what I want to do is make a checkbox marked only if the item is already listed in the edit_order template. Right now, all of the items are marked. but I don't want this.</p>
  
  <p>edit_order.html</p>
  
  <pre><code> {% for item in items %}
                  &lt;tr&gt;
                  &lt;td&gt;&lt;input type="checkbox" name="item" value="{{item.pk}}" checked="checked"&gt;&lt;/td&gt;
                  &lt;td&gt;{{item.tiptop_id}}&lt;/td&gt;&lt;td&gt;{{item.alternative_id}}&lt;/td&gt;&lt;td&gt;{{item.title}}&lt;/td&gt;
                  &lt;td&gt;{{item.type}}&lt;/td&gt;&lt;td&gt;{{item.format}}&lt;/td&gt;
  
                  &lt;/tr&gt;
              {% endfor %}
  </code></pre>
  
  <p>item.html</p>
  
  <pre><code> {% extends "base_menu.html" %}
      {%block script%}
      &lt;script type="text/javascript"&gt;
              $(function(){
                      $("#check_all").click(function(){
                              if(this.checked ==true)
                                              $("tbody :checkbox").each(function(){
                                                      this.checked=true;
                                              });
                                      else
                                              $("tbody :checkbox").each(function(){
                                                      this.checked=false;
                                              });
                      });
              });
      &lt;/script&gt;
      {%endblock%}
  
  
      &lt;td&gt;&lt;a href="{% url tiptop.views.edit_item item.client.pk item.pk %}" onclick="return showAddAnotherPopup(this);"&gt;Edit&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
  {% endfor %}
  &lt;/tbody&gt;
  &lt;/table&gt;&lt;/fieldset&gt;
  &lt;/div&gt;
  &lt;div id="form_footer"&gt;
                  &lt;input type="submit" value="Request Delivery" onclick="change_action('{% url tiptop.views.service_order client.pk 1 %}')"&gt;
                  &lt;input type="submit" value="Request Pick Up" onclick="change_action('{% url tiptop.views.service_order client.pk 2 %}');validate_status(this.form)"&gt;
          &lt;/div&gt;
  
  
  &lt;/form&gt;
  {% endblock %}
  
          {% block right_content %}
          &lt;div id="location_header"&gt;{{client}}: Search results&lt;/div&gt;
          &lt;form action="{% url tiptop.views.service_order client.pk 1 %}" method="post" onsubmit="return validate_selection(this)"&gt;
          &lt;div class="form_container"&gt;
      &lt;fieldset class="model"&gt;
      &lt;table id="items_table"&gt;
              &lt;thead&gt;
              &lt;tr&gt;
                      &lt;th&gt;&lt;input type="checkbox" id="check_all" checked="checked"&gt;&lt;/th&gt;
                      &lt;th scope="col"&gt;Tiptop no.&lt;/th&gt;&lt;th scope="col"&gt;Client no.&lt;/th&gt;&lt;th scope="col"&gt;Title&lt;/th&gt;&lt;th scope="col"&gt;Type&lt;/th&gt;
                      &lt;th scope="col"&gt;Format&lt;/th&gt;&lt;th scope="col"&gt;Status&lt;/th&gt;&lt;th scope="col"&gt;Date&lt;/th&gt;
              &lt;/tr&gt;
              &lt;/thead&gt;
              &lt;tbody&gt;
      {% for item in items %}
              &lt;tr class="items_table_row"&gt;
                      &lt;td&gt;&lt;input type="checkbox" name="{{item.pk}}" value="{{item.pk}}" checked="checked"&gt;&lt;/td&gt;
                      &lt;td&gt;{{item.tiptop_id}}&lt;/td&gt;&lt;td&gt;{{item.alternative_id}}&lt;/td&gt;&lt;td&gt;{{item.title}}&lt;/td&gt;&lt;td&gt;{{item.type}}&lt;/td&gt;&lt;td&gt;{{item.format}}&lt;/td&gt;
                      &lt;td&gt;&lt;span id="{{item.pk}}" name="type"&gt;{{item.itemstatushistory_set.latest}}&lt;/span&gt;&lt;/td&gt;&lt;td&gt;{{item.itemstatushistory_set.latest.date.date|date:"d M Y"}}&lt;/td&gt;
  </code></pre>