because you're passing commit=False with form2

On Tue, 1 Jun 2021 at 14:10, Hugh Frost <mohansaravanan...@gmail.com> wrote:

> def detail(request):
>     if request.method == 'POST':
>         baby_form1 = BabyForm1(data=request.POST)
>         baby_form2 = BabyForm2(data=request.POST)
>
>         if baby_form1.is_valid() and baby_form2.is_valid():
>             baby_form1.save()
>             print(baby_form1)
>             baby_form2.baby_form1 = baby_form1
>             baby_form2.save(commit=False)
>             print(baby_form2)
>             baby_form2.baby_form1
>
>             return redirect('userapp:home')
>
>
>     else:
>         baby_form1 = BabyForm1()
>         baby_form2 = BabyForm2()
>     return render(request,'userapp_temp/profile.html',
> {'baby_form1':baby_form1, 'baby_form2':baby_form2,})
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/73c21cb8-9127-401c-88b2-fa94446cc37bn%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/73c21cb8-9127-401c-88b2-fa94446cc37bn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVEjC4N4p9R-4JsGd%3Dh78bvZUz-XDij6_aA-4fgtmcQEjA%40mail.gmail.com.

Reply via email to