Unless your model has defined columns with unique_together, and the
form attempts to save fields which violate the constraint.  In that
case, an integrity exception is raised because ModelForm does not
currently valid it.  You must perform this validation yourself.



On Apr 19, 10:20 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Sat, 2008-04-19 at 13:18 -0700, John wrote:
> > If you have code like this using a form that subclasses ModelForm:
>
> > if request.method == 'POST':
> >     form = MyModelForm(request.POST, instance=some_instance)
> >     form.is_valid():
> >        form.save()
>
> > Does MyModelForm first fill it's fields with data from some_instance,
> > and then override with the data that is in request.POST?  Thanks.
>
> Surely this is pretty easy to test out and see in a quick example?
>
> Yes, the model instance has its existing values overridden by the POST
> data. Only applicable in the case when you specify fields to exclude (or
> a subset of fields to include); in those cases, the fields not included
> are left unchanged.
>
> Regards,
> Malcolm
>
> --
> Depression is merely anger without 
> enthusiasm.http://www.pointy-stick.com/blog/
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to