hi,

I have a modelform to which I have added a bunch of extra fields by overriding 
__init__(). Adding a new instance works fine, I use fm=Myform(request.POST) and 
fm.save() saves the Model, and then I can access request.POST directly for the 
information in the extra fields and save them to their own model. But when 
editing an existing model instance, I am unable to succeed. I create a dic for 
the data in the extra fields, and do form=Myform(data=data,instance=instance). 
This correctly displays the data in the extra fields, but only some of the data 
in the the Model. I tried passing the data as initial data to the overridden 
__init__. The data displays properly, but the line 
Myform(request.POST,instance=instance) crashes with a key error - the keys in 
request.POST that are not found in instance. Question is: can this be done, or 
should I go back to using normal forms?
-- 
regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS
http://certificate.nrcfoss.au-kbc.org.in

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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