django form two buttons in one form only one should work code example
Example: how to submit two forms in django
if request.method == 'POST':
form1 = Form1( request.POST,prefix="form1")
form2 = Form2( request.POST,prefix="form2")
if form1.is_valid():
else:
context['form1']= form1
if form2.is_valid():
else:
context['form2']= form2
if form1.is_valid() and form2.is_valid():
return redirect('page')
else:
return render('/page', context)
else:
form1 = Form1(prefix="form1")
form2 = Form2(prefix="form2")