title: How to save POST data with multiple checkboxes using Django ?
body: <p>Django version=1.10.2 and python 2.7
  Im learning django and trying to clone to-do list item like <a href="http://todomvc.com/examples/react/#/" rel="nofollow noreferrer">this</a>
  Here is the models file for todo:-</p>
  
  <pre><code>class Todo(models.Model):
      title = models.CharField(max_length=200)
      # text = models.TextField()
      completed = models.BooleanField(null=False,default=False)
  
      created_at = models.DateTimeField(auto_now_add=True)
      def __str__(self):
          return self.title   #this makes djangoadmin page show title inthe list
  </code></pre>
  
  <p>The views file</p>
  
  <pre><code>from django.shortcuts import render
  from models import Todo
  def index(request):
      todos = Todo.objects.all()
      context = {
          'todos':todos
      }
      if request.method == 'POST':
          title = request.POST['title']
          todo = Todo(title=title)
          todo.save()
          return render(request,'index.html',context)
      else:
          return render(request,'index.html',context)
  
  def show_completed(request): #show completed task only
      todos = Todo.objects.filter(completed=True)
      context = {
          'todos': todos
      }
      return render(request, 'index.html', context)
  
  def show_active(request):   #show active task list
      todos = Todo.objects.filter(completed=False)
      context = {
          'todos': todos
      }
      return render(request, 'index.html', context)
  def clear_completed(request):    #Delete the completed tasks
      Todo.objects.filter(completed=True).delete()
      todos = Todo.objects.all()
      context = {
          'todos': todos
      }
      return render(request, 'index.html', context)
  
  def save_state(request):
       pass
  </code></pre>
  
  <p>The template file "index.html"</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h3&gt;Todo List:&lt;/h3&gt;&lt;hr&gt;
  
  &lt;form method="post" action="{% url 'index' %}"&gt;
      {% csrf_token %}
      &lt;input type="text" name="title" id="title"/&gt;
      &lt;input type="submit" value="submit" /&gt;
  &lt;/form&gt;
  &lt;hr&gt;&lt;br&gt;
  &lt;form method="post" action="{% url 'save_state'%}"&gt;
  {% csrf_token %}
  &lt;ul&gt;{% for todo in todos %}
      &lt;li&gt;  &lt;input type="checkbox" name="completed" value="True" {% if todo.completed is True %} checked = "checked" {% endif %} &gt;{{ todo.title }}   &lt;/li&gt;
  {% endfor %}
  &lt;/ul&gt;
   &lt;input type="submit" value="Submit"&gt;
  &lt;/form&gt;
  &lt;a href="/todos/"&gt;All&lt;/a&gt;
  &lt;a href="/todos/active"&gt;Active&lt;/a&gt;
  &lt;a href="/todos/completed"&gt;Completed&lt;/a&gt;
  &lt;a href="/todos/clear_completed"&gt;ClearCompleted&lt;/a&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I want to know how to get the checkbox's of todo items and save it if the checkbox is checked by passing those to view called "save_state"</p>