I have the following code:
def test_view(request, list):
my_form = MyForm(request.POST)
for x in list:
my_instance = my_form.save(commit = false)
my_instance.variable_field = x['content']
my_form.save()
Now for some reason, new record is inserted into the DB only during the first iteration. My guess is that it has something to do with form prefixes, but I still didn't come across any material in the doc describing how to tackle this situation appropriately.
UPDATE: Just to clarify: I have a form which underlying instance contain a field that I've excluded from the form and turned it into a selectize element in my interface. The user can choose multiple options in the selectize, that's why I need the for-loop in the code extract.