On Tue, Feb 8, 2011 at 3:37 PM, sushanth Reddy <sushant...@gmail.com> wrote:
> I am trying to insert data into db it throws below error,can any please fix
> this.

form.Fields normalize to a python value. That python value must be
assignable to the model field you are trying to update. You cannot
assign a string to a foreign key field, it expects an instance of the
object that it is a foreign key for.

The solution is to use field that normalizes to the correct value, in
this case a ModelChoiceField. If you don't want it to appear, you can
still use a HiddenInput widget, but it must be a ModelChoiceField if
you want to assign it to a foreign key field.

Cheers

Tom

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