Private
Public Access
1
0

Course Times Standards CSV v1 working

This commit is contained in:
Sander Roosendaal
2020-05-26 18:12:23 +02:00
parent b953d2714b
commit 496f265908
7 changed files with 362 additions and 17 deletions

View File

@@ -30,7 +30,7 @@
Please correct the error{{ form.errors|pluralize }} below.
</p>
{% endif %}
<table>
{{ form.as_table }}
</table>
@@ -71,13 +71,13 @@
if (!formdatasetok) {
$("#id_dropregion").remove();
}
if (formdatasetok) {
$(document).ready(function() {
var csrftoken = jQuery("[name=csrfmiddlewaretoken]").val();
console.log("CSRF token",csrftoken);
function csrfSafeMethod(method) {
// these HTTP methods do not require CSRF protection
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
@@ -95,11 +95,11 @@
$(window).on('dragenter', function() {
$("#id_drop-files").css("background-color","#E9E9E4");
$("#id_dropregion").addClass("watermark").removeClass("invisible");})
$(window).on('dragleave', function() {
$("#id_drop-files").css("background-color","#FFFFFF");
$("#id_dropregion").removeClass("watermark").addClass("invisible");})
var frm = $("#file_form");
if( window.FormData === undefined ) {
@@ -108,7 +108,7 @@
} else {
console.log('we have formdata');
}
var data = new FormData(frm[0]);
@@ -144,7 +144,7 @@
}
}
});
});
$('input').each(function( i ) {
$(this).change(function() {
@@ -159,7 +159,14 @@
console.log($(this).attr('name'),$(this).val());
};
});});
$('textarea').each(function( i ) {
$(this).change(function() {
data.set($(this).attr('name'),$(this).val());
console.log($(this).attr('name'),$(this).val());
});
});
$('select').each(function( i ) {
console.log($(this).attr('name'),$(this).val());
$(this).change(function() {
@@ -200,7 +207,7 @@
console.log(result," reloading");
location.reload();
};
}
}
});
return false;
});
@@ -236,7 +243,7 @@
$("#id_file").value = 0;
return false;
}
data.set("file",f);
data.set("file",f);
// data.append("file",f);
$("#id_file").replaceWith('<div id="id_file">'+files[0].name+'&nbsp; <a class="remove" href="javascript:void(0);"><b><font color="red">X</font></b></a></div>');