I think the reason you're getting the error you are is that you didn't
add 'company' to 'exclude' in your modelform.
The code you pasted indicates that you will have an existing object 100%
of the time in this view. If that's the case, your line to instantiate
the form with request.POST and the instance kwarg should take care of
remembering its existing 'company' value.
If you want one form that is used for both creating a new Contact and
editing an existing contact then there are ways to do that too.
Here's one:
In the __init__ of your form, check whether self.instance.id exists. If
so, you can del(self.fields['company']). It won't be available in the
form. Then, if you pass 'instance' when you create the form in your view
your modelform will know what the proper value is.
--
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.