On Sat, May 14, 2011 at 7:35 PM, Shawn Milochik <sh...@milochik.com> wrote: > That 'name = Charfield' doesn't belong there at all. > > Replace that line with this: > exclude = ['company'] > > If you did want to add extra fields to a ModelForm you'd put them at the top > -- the same place as you would in a Form. Just FYI -- you don't need one > here.
But how do I handle the scenario I described? I only need to set the company when I create the record. I do not need to set it or have it validated when I edit the record. Why does this code not take into account my company is already set? contact = Contact.objects.get( pk=id ) form = ContactForm( instance=contact ) if request.method == 'POST': form = ContactForm( request.POST, instance=contact ) if form.is_valid(): form.save() Why do I get errors when I don't include previously set data? ipdb> form.errors {'company': [u'This field is required.']} -- Greg Donald destiney.com | gregdonald.com -- 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.