stops on error
This commit is contained in:
@@ -3,7 +3,10 @@
|
||||
import shutil
|
||||
import time
|
||||
from django.conf import settings
|
||||
from rowers.tasks import handle_sendemail_unrecognized
|
||||
from rowers.tasks import (
|
||||
handle_sendemail_unrecognized,
|
||||
handle_sendemail_unrecognizedowner
|
||||
)
|
||||
from django_mailbox.models import Message, MessageAttachment
|
||||
from rowers.models import User, Rower, RowerForm
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
|
||||
{% block scripts %}
|
||||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
console.log("Loading dropper");
|
||||
@@ -109,15 +109,18 @@
|
||||
var data = new FormData(frm[0]);
|
||||
|
||||
$('input').each(function( i ) {
|
||||
console.log($(this).attr('name'),$(this).val());
|
||||
$(this).change(function() {
|
||||
data.set($(this).attr('name'),$(this).val());
|
||||
if ($(this).attr('id') == 'id_file') {
|
||||
data.set("file",this.files[0]);
|
||||
if ($(this).attr('type') == 'checkbox') {
|
||||
data.set($(this).attr('name'),$(this).prop('checked'));
|
||||
console.log($(this).attr('id'),$(this).attr('name'),$(this).prop('checked'));
|
||||
} else {
|
||||
data.set($(this).attr('name'),$(this).val());
|
||||
if ($(this).attr('id') == 'id_file') {
|
||||
data.set("file",this.files[0]);
|
||||
}
|
||||
console.log($(this).attr('name'),$(this).val());
|
||||
};
|
||||
console.log($(this).attr('name'),$(this).val());
|
||||
});
|
||||
});
|
||||
});});
|
||||
|
||||
$('select').each(function( i ) {
|
||||
console.log($(this).attr('name'),$(this).val());
|
||||
@@ -130,20 +133,31 @@
|
||||
frm.submit(function() {
|
||||
console.log("Form submission");
|
||||
console.log(data);
|
||||
$("#id_drop-files").replaceWith(
|
||||
'<div id="id_waiting"><img src="/static/img/ajax_loader_blue_350.gif" width="120" height="100">'
|
||||
);
|
||||
$.ajax({
|
||||
data: data,
|
||||
type: $(this).attr('method'),
|
||||
url: '/rowers/workout/upload_ajax/',
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function(result) {
|
||||
console.log('got something back');
|
||||
console.log(result);
|
||||
if (result.result == 1) {
|
||||
window.location.href = result.url;
|
||||
}
|
||||
}
|
||||
});
|
||||
data: data,
|
||||
type: $(this).attr('method'),
|
||||
url: '/rowers/workout/upload_ajax/',
|
||||
contentType: false,
|
||||
processData: false,
|
||||
error: function(result) {
|
||||
$("#id_waiting").replaceWith(
|
||||
'<div id="id_failed" class="grid_12 message">Your upload failed</div>'
|
||||
);
|
||||
setTimeout(function() {
|
||||
location.reload();
|
||||
},1000);
|
||||
},
|
||||
success: function(result) {
|
||||
console.log('got something back');
|
||||
console.log(result);
|
||||
if (result.result == 1) {
|
||||
window.location.href = result.url;
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
@@ -8681,7 +8681,8 @@ def workout_upload_ajax(request,
|
||||
else:
|
||||
response = {'result':0}
|
||||
return JSONResponse(response)
|
||||
|
||||
|
||||
@login_required()
|
||||
def workout_upload_view(request,
|
||||
uploadoptions={
|
||||
'makeprivate':False,
|
||||
|
||||
Reference in New Issue
Block a user