Django - dynamic form with multiple selection field

I'm looking for a snippet that allows you to create dynamic django forms ... with multiple selection fields.

I found a fragment about this on the link .

But even if the guy says what we need to do to get a fragment working with several selection fields, this is not for me!

I am new to django and python, so hope you could help me! I hope I was "readable" and regretted my poor English.

Thanks. Victor

+4
source share
2 answers

There are 2 good blog posts on this

+3
source
def create_form(): class DynamicForm(forms.Form): pass # Add dynamic fields to form class field = forms.fields.ChoiceField(label='test', choices=((0, '0'), (1, '1'))) DynamicForm.base_fields['field_name'] = field return DynamicForm() 
+2
source

All Articles