My index.html file contains one large form which gets tons of user input. Towards the end of the form, I want to give the user an option to upload a file using a button. But this should not trigger the form submission because they may want to continue entering data into other parts of the form. Here is a basic overview of the HTML:
((some other stuff))
<form id="outer_form">
((other HTML stuff))
<form enctype="multipart/form-data" method="post" action="{% url 'my_app:upload_file' %}" id="file-upload-form">
{% csrf_token %}
<input type="file" name="file" style="display: none">
<button type="button" class="btn btn-primary" id="btn-upload-file">Upload file</button>
</form>
((more other stuff))
((submit button for the outer form))
</form>
((other stuff))
Of course, this won't work because I have nested FORM elements which is illegal. How can I combine these two ideas, keeping the CSFR token and using the correct django action for the upload button? Thanks!