Bob:

> In this case the user has already navigated to some bar record and is
> trying to add a foo child record, so I know what the bar_id value is
> already and I'm not exposing bar_id to the user as an editable field.
> How do I get the current bar_id into foo record I'm creating with
> form.save()?
>
You should add the relationship before saving the form.  Maybe
something like this (had no time to try it, but I will try later):

if request.method == 'POST':
    form = FooForm(request.POST)
    if form.is_valid():
      form.clean_data['bar_id'] = bar_id
      form.save()
      (...)

RobertoZ



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