customStorage manager in Sistemas app and zip views to upload the zip
This commit is contained in:
51
Templates/Sistemas/manageSystem/uploadZip.html
Normal file
51
Templates/Sistemas/manageSystem/uploadZip.html
Normal file
@@ -0,0 +1,51 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}
|
||||
| Sistemas
|
||||
{% endblock title %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
<form id="upload-form">
|
||||
<input type="file" name="zip_file">
|
||||
<button type="submit">Upload</button>
|
||||
</form>
|
||||
<input type="hidden" id="id_token" name="token" value="{{ token }}">
|
||||
{% endblock content %}
|
||||
|
||||
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
|
||||
document.getElementById('upload-form').addEventListener('submit', function (event) {
|
||||
event.preventDefault();
|
||||
let formData = new FormData(event.target);
|
||||
let token = document.getElementById("id_token").value;
|
||||
fetch(`{% url 'uploadZip' %}`, {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
headers: {
|
||||
'Authorization': 'Token ' + token,
|
||||
},
|
||||
})
|
||||
.then(function (response) {
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok');
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(function (data) {
|
||||
console.log(data);
|
||||
window.location.reload();
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.error(error);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
{% endblock scripts %}
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<div class="dropdown-divider"></div>
|
||||
{% endif %}
|
||||
|
||||
<a class="dropdown-item" href="#">Something else here</a>
|
||||
<a class="dropdown-item" href="{% url 'uploadZipViewHTML' %}">Actualizar CFDI Version</a>
|
||||
</div>
|
||||
</li>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user