Thank you shaw!

It works!

if form.is_valid() and formE.is_valid():
            address = formE.save(commit=True)
            employee = form.save(commit=False)
            employee.address = address
            employee.save()

## redirect to html list

Thanks!



On 13 maio, 16:17, Shawn Milochik <sh...@milochik.com> wrote:
> To do that you need to add a Meta to your ModelForm and exclude the
> address. Then add another ModelForm for Address and put both on the page
> at the same time.
>
> Then, after the POST, you'll need to first save the address and then add
> it to the cleaned_data of the employee form (or its self.instance)
> before saving.
>
> Not to confuse you, but you can also save the employee first if you use
> "commit = False" in the save(), then save and add the address, then save
> the employee again normally.
>
> 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