I have a form, which must have two ways of submitting. If user pressing “add” button it is saving in the database and if user pressing “view” button the form saving in the session, so it’s just a view. Both of the processes are synchronous, pages are reloads every time the submit button pressed.
How to submit the form in two different addresses or how to add request.POST variable to specify the logic in the backend? Is it possible by html, django template system or javascript?
<table>
<form class="add-cv" method="POST" action="{% url add_cv %}">
{% csrf_token %}
<!--A lot of form fields-->
<tr>
<td>
<input type="submit" value="{% trans "Add" %}">
<input type="submit" value="{% trans "View" %}">
</td>
</tr>
</form>
</table>
add the name attribute to the submit
name="submit1"andname="submit2"and then, you can difference between them in your add_cv view: