On Sunday, February 20, 2011 12:05:12 PM UTC, The_Legend wrote:
>
> Oh sorry, i thought i wrote, but i guess it didnt convey the message. 
>
> have written a registration form. so it takes data from this form then 
> first creates a user  then i have a model called people in my app 
> called mainapp. so i just need to add data to the database for this 
> model. but i am not able to. 
>
> in this part if i give it like this --- 
>
> dt = people() 
> tform=popform(instance=dt) 
> form = tform(perDict) 
>     if form.is_valid():    ------ it says object not callable -- 
> tform(perDict) where perDict is dictionary 
>
> and if i give 
> dt = people() 
> form = popform(perDict) 
>     if form.is_valid():    ------then it always comesout invalid 


Well, there was no way to tell that from the original posting because it 
didn't include any of that code.

This code is very bizarre. You instantiate the form with 
`tform=popform(instance=dt)` and then attempt to call it again with 
`tform(perDict)`. I expect that the `object not callable` exception actually 
happens here, not in the is_valid() call.

The correct way to instantiate a form from a post using an existing model 
instance is to pass both arguments at the same time:

    `tform = popform(perDict, instance=dt)`

Also, you should consider why you need to pre-process the request to get the 
perDict dictionary. It would make more sense to use the same field names in 
the template as in the form.
--
DR.

-- 
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