'How Can I Create Array Form Input in Django

I have the following form input in my template that displays questions from the database.

<input type="text" name="qus[{{ question.id }}]" id="qus" value="{{ question.quest }}" />

I created my Django form with:

class QuestionForm(forms.Form):
      qus = SimpleArrayField(forms.CharField(max_length = 50))

Each time I submit the form, it does'nt work. It seems the form is not valid

 MyQuestionForm = QuestionForm(request.POST)
 if request.method == "POST" and MyQuestionForm.is_valid():
     

How can I create the form properly and loop through request.POST['qus'] to retrieve all the values when I submit the form? Please help.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source