title: Django - How to increment integer field from user input?
body: <p>I'm new to Django, but I'm building a website where people can make statements regarding certain debatable topics. Right now I've just manually added a few statements for each debate and I'd like the users to have the ability to "vote" on a statement.</p>
  
  <p>Here's the code I have now:</p>
  
  <p>Code from models.py</p>
  
  <pre><code>class Debate(models.Model):
      title = models.CharField(max_length=50)
      description = models.CharField(max_length=100)
      pub_date = models.DateTimeField('Date Published')
      url_slug = models.SlugField(editable=False)
      def __unicode__(self):
          return self.title
  
  class Statement(models.Model):
      statement = models.CharField(max_length=200)
      debate = models.ForeignKey(Debate)
      votes = models.IntegerField(default=0)
      user = models.ForeignKey(User)
      def __unicode__(self):
          return self.statement
  </code></pre>
  
  <p>Code from views.py</p>
  
  <pre><code>def debate_page(request, url_slug):
      if request.method == 'POST':
          for statement in statements:
              statement.votes = statement.votes+1
  
      debate = Debate.objects.get(url_slug=url_slug)
      template = get_template('debate_page.html')
      statements = Statement.objects.filter(debate=debate)
  
      variables = Context ({
          'debate_title': debate.title,
          'debate_description': debate.description,
          'statements': statements,
      })
  
      output = template.render(variables)
      return HttpResponse(output)
  </code></pre>
  
  <p>Code from template</p>
  
  <pre><code>{% extends "base.html" %}
  {% block title %}{{ debate_title }}{% endblock %}
  {% block head %}{{ debate_title }}{% endblock %}
  {% block description %}{{ debate_description }}{% endblock %}
  {% block content %} 
          {% for statement in statements %}
              &lt;li&gt;{{ statement }} - {{ statement.votes }}
              &lt;input type="checkbox" name="statement" value="{{ statement.id }}" /&gt;&lt;/li&gt;&lt;br /&gt;
          {% endfor %}
          &lt;input type="submit" value="Submit" /&gt;      
  {% endblock %}
  </code></pre>
  
  <p>So what I'd like is for a visitor to check a box next to the statement that they agree with and then click the submit button. Doing that would increase the votes attribute for the statement by 1. I just can't figure out how to get user input and make a change to the database. </p>
  
  <p>Thanks!</p>