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