upload options work in background upload
This commit is contained in:
@@ -114,7 +114,11 @@ class Command(BaseCommand):
|
||||
extension = attachment.document.name[-3:].lower()
|
||||
try:
|
||||
message = Message.objects.get(id=attachment.message_id)
|
||||
body = "\n".join(message.text.splitlines())
|
||||
if message.text:
|
||||
body = "\n".join(message.text.splitlines())
|
||||
else:
|
||||
body = message.body
|
||||
|
||||
uploadoptions = uploads.upload_options(body)
|
||||
from_address = message.from_address[0].lower()
|
||||
name = message.subject
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
If you check "make private", this workout will not be visible to your followers and will not show up in your teams' workouts list. With the Landing Page option, you can select to which (workout related) page you will be
|
||||
taken after a successfull upload.
|
||||
</p>
|
||||
<p>Select Files with the File button or drag them on the marked area</p>
|
||||
<p><b>Select Files with the File button or drag them on the marked area</b></p>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -141,7 +141,7 @@
|
||||
$('#id_offline').prop('checked','True');
|
||||
data.set($('#id_offline').attr('name'),$('#id_offline').prop('checked'));
|
||||
console.log("Set offline to True");
|
||||
$('#extra_message').text('Because of the large size, we recommend to use background processing. You will receive email when it is done. The extra actions will not be performed.');
|
||||
$('#extra_message').text('Because of the large size, we recommend to use background processing. You will receive email when it is done.');
|
||||
$('#extra_message').addClass('message');
|
||||
}
|
||||
}
|
||||
@@ -240,7 +240,7 @@
|
||||
$('#id_offline').prop('checked','True');
|
||||
data.set($('#id_offline').attr('name'),$('#id_offline').prop('checked'));
|
||||
console.log("Set offline to True");
|
||||
$('#extra_message').text('Because of the large size, we recommend to use background processing. You will receive email when it is done. The extra actions will not be performed.');
|
||||
$('#extra_message').text('Because of the large size, we recommend to use background processing. You will receive email when it is done.');
|
||||
$('#extra_message').addClass('message');
|
||||
}
|
||||
data.set("file",f);
|
||||
|
||||
@@ -191,6 +191,8 @@ def upload_options(body):
|
||||
body = cleanbody(body)
|
||||
try:
|
||||
yml = (yaml.load(body))
|
||||
if 'fromuploadform' in yml:
|
||||
return yml
|
||||
try:
|
||||
for key, value in yml.iteritems():
|
||||
lowkey = key.lower()
|
||||
|
||||
@@ -8,6 +8,7 @@ import pytz
|
||||
import operator
|
||||
import warnings
|
||||
import urllib
|
||||
import yaml
|
||||
from PIL import Image
|
||||
from numbers import Number
|
||||
from django.views.generic.base import TemplateView
|
||||
@@ -8551,9 +8552,14 @@ def workout_upload_view(request,
|
||||
)
|
||||
else:
|
||||
workoutsbox = Mailbox.objects.filter(name='workouts')[0]
|
||||
uploadoptions['fromuploadform'] = True
|
||||
bodyyaml = yaml.safe_dump(
|
||||
uploadoptions,
|
||||
default_flow_style=False
|
||||
)
|
||||
msg = Message(mailbox=workoutsbox,
|
||||
from_header=r.user.email,
|
||||
subject = t)
|
||||
subject = t,body=bodyyaml)
|
||||
msg.save()
|
||||
f3 = 'media/mailbox_attachments/'+f2[6:]
|
||||
copyfile(f2,f3)
|
||||
|
||||
Reference in New Issue
Block a user