James,

Thanks again so much.

I think i tried the commit=False bit but it still didn't like my FK being
blank for some reason.  I'll have to look through the django source and
double check.

So, assuming my commit=false works, i should be able to say something like:

form.clean_data['fk_id'] = fkobjid

?

Thanks

John

On 5/16/07, James Bennett <[EMAIL PROTECTED]> wrote:
>
>
> On 5/16/07, John M <[EMAIL PROTECTED]> wrote:
> > Thanks for info, but what happens when the form.save() is called,
> > since the FK isn't part of the clean_data, it will fail no?
>
> Form.save accepts a 'commit' keyword argument, which default to True;
> when it's True the form will try to actually save to the database, and
> when it's False it won't. So if you know that you don't yet have
> enough data to correctly save to the DB, you can do:
>
> new_obj = form.save(commit=False)
> #...do more stuff with the object before saving to the DB
>
> Either way, 'save()' will return the object, but passing commit=False
> will tell it you're not ready to hit the DB just yet.
>
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of
> correct."
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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