Yup It worked! I saved the form with excluded foreign key with commit=False.
Then set the proper instance to foreign key and then saved. It worked just
fine.

Thanks for the help :)

On Thu, Aug 27, 2009 at 10:47 PM, Shawn Milochik <shawn.m...@gmail.com>wrote:

>
> There are different options, depending on whether the instance of B is
> a required part of A's model.
>
> 1. You can add an "exclude" section to your ModelForm of A. Validate
> BForm, validate AForm, then take the resulting instance of A and set
> it's 'b' attribute to the resulting instance of BForm.save().
>
> 2. Validate BForm first. Then, before AForm.is_valid(), you set
> AForm.data['B'] manually, to B.pk, then validate A.
>
> Maybe there's a more elegant way, but those will work.
>
> Shawn
>
>
> >
>

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