title: Django and radio buttons
body: <p>I am implementing a quiz app and I am displaying the multiple choice answers using radio buttons.</p>
  
  <p>I need to group the answers per question, so I have it like this</p>
  
  <pre><code>{% for answer in quiz.quizanswer_set.all %}
  &lt;p&gt;&lt;input type="radio" name="score[{{quiz.id}}]" value="{{answer.score}}"/&gt;{{answer.answer}}&lt;/p&gt;
  {% endfor %}
  </code></pre>
  
  <p>When I hit submit, I have the POST object like this</p>
  
  <pre><code>&lt;QueryDict: {u'score[1]': [u'10'], u'score[3]': [u'10'], u'score[2]': [u'10'], u'Get Result': [u'Submit']}&gt;
  </code></pre>
  
  <p>How do I loop through the scores in a canonical way?</p>
  
  <p>I have tried <code>request.POST.getlist('score')</code> and it returns empty list</p>
  
  <p>PS. the quiz.id may not in sequence, it's from the database row id.</p>
  
  <p>My current work around is:</p>
  
  <pre><code>for quiz in Quiz.objects.all():
          total_score += int(request.POST.get('score[{0}]'.format(quiz.id)))
  </code></pre>