Hi all,

I want to create a form with dynamic fields. That is, I want to add the
fields using the __init__ method of my form:

1   class MyForm(forms.Form):
2       def __init__(self, fieldnames=(), *args, **kw):
3           for fieldname in fieldnames:
4               self.XXXfieldnameXXX = forms.CharField(...)
5           super(MyForm, self).__init__(*args, **kw)

What is the correct syntax for line 4? Is this even possible?

Martin

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to