Answer the question
In order to leave comments, you need to log in
2 save buttons on one page. How to name these functions and use them?
How to create 2 forms on one page for filling in data and implement separate functions for saving to the database?
On the Internet, I read about naming save functions and found this example:
<form method='POST'>
{{form1.as_p}}
<button type="submit" name="btnform1">Save Changes</button>
</form>
<form method='POST'>
{{form2.as_p}}
<button type="submit" name="btnform2">Save Changes</button>
</form>
if request.method=='POST' and 'btnform1' in request.POST:
do something...
if request.method=='POST' and 'btnform2' in request.POST:
do something...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question