Re: Help with Forms (Dynamic Fields) - SOLVED

2008-07-16 Thread Srik
Solved On Jul 16, 3:39 pm, Srik <[EMAIL PROTECTED]> wrote: > Thanks Jeff. > > I also realized there is a provision to pass nested tuple like choices > to form while initalizing using field_list (Not documented but found > in django testing documents) > >

Re: Help with Forms (Dynamic Fields) - SOLVED (Request to update documentation if possible)

2008-07-16 Thread Srik
Thanks Jeff. I also realized there is a provision to pass nested tuple like choices to form while initalizing using field_list (Not documented but found in django testing documents) http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/forms.py (lines 715 - 797 )

Re: Help with Forms (Dynamic Fields)

2008-07-16 Thread Jeff FW
In __init__, where you call form.Form's __init__, you need to pass data, *not* None. Also, you shouldn't try to duplicate all of the arguments. This should work better: def __init__(self, cat_slug, data=None, *args, **kwargs): forms.Form.__init__(self, data=data, *args, **kwargs) Also,

Re: Help with Forms (Dynamic Fields)

2008-07-16 Thread Srik
Hi Jeff, I did try to move __init__ but the problem still exists. I tried to keep title and email along with other fields so that they will be appear in same order in Form. class MyForm(forms.Form): def __init__(self, cat_slug, data=None, files=None, auto_id='id_%s', prefix=None,

Re: Help with Forms (Dynamic Fields)

2008-07-15 Thread Jeff FW
You have to pass the data into the form when instantiating it, eg: form = MyForm(request.POST) However, that means (for your example), the fields wouldn't exist yet-- move them into __init__ instead. Some other things to note: you don't need to "title" and "email" to the form dynamically--might

Help with Forms (Dynamic Fields)

2008-07-15 Thread Srik
Hi Djangoers, I'm trying to generate a form dynamically using MyForm (Form class), but I'm stuck with validating or populating data. Form Class, View and template Code here: http://dpaste.com/65080/ (not too many lines I guess :) ) Good thing is I can see form (generating dynamically, based on