I need to create django form with checkbox fields. Number of fields and value of "checked" attribute are dynamic.
I created form:
form = DynamicForm()
for field in all_fields:
if field in checked_field:
form.fields[field.id]=forms.BooleanField(label=field.name, initial=True)
else:
form.fields[field.id]=forms.BooleanField(label=field.name, initial=False)
return form
,but this form has different value of "name" attribute for each field (name=field.id). How to set the same name for every field?