Sunday, March 18, 2012

getting problem while submiting in dynamic form

hi,
i m trying to create dynamic form with corresponding fields using
following code. But getting problem while submiting value.
If i entered blank value then error is :

Attribute Error:

'module' object has no attribute ''
in forms.py


and if I entered value for salary then error is:

Attribute Error:

'module' object has no attribute '100000'
in forms.py


Here is forms.py

from django import forms
class ContextForm(forms.Form):
def __init__(self. rdict, *args, **kwargs):
super(ContextForm, self).__init__(*args, **kwargs)
for key in rdict.keys():
self.fields['%s' % str(key)] = getattr(forms,
rdict.get(key))()
-----------------------------------------------------------------------------------------------
rdict = {<Attributetype: address>: 'CharField', <Attributetype:
phone>: 'CharField', <Attributetype: Salary>: 'IntegerField',
<Attributetype: first name>: 'CharField', <Attributetype: last name>:
'CharField'}

c = ContextForm(rdict)

plz help me for this
Thank you

--
Regards,
Shweta Chaughule

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate