diff --git a/rowers/tasks.py b/rowers/tasks.py index 6eff4751..3301800e 100644 --- a/rowers/tasks.py +++ b/rowers/tasks.py @@ -305,6 +305,7 @@ def handle_zip_file(emailfrom, subject, file,**kwargs): if debug: print message + email = EmailMessage(subject, message, emailfrom, ['workouts@rowsandall.com']) diff --git a/rowers/views.py b/rowers/views.py index 5f6c87a8..bfa49541 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -143,6 +143,8 @@ from rq.registry import StartedJobRegistry from rq import Queue,cancel_job from django.core.cache import cache +from django_mailbox.models import Message,Mailbox,MessageAttachment + # Utility to get stroke data in a JSON response class JSONResponse(HttpResponse): @@ -8548,12 +8550,23 @@ def workout_upload_view(request, notes='' ) else: - job = myqueue( - queuehigh, - handle_zip_file, - r.user.email, - t, - f2) + workoutsbox = Mailbox.objects.filter(name='workouts')[0] + msg = Message(mailbox=workoutsbox, + from_header=r.user.email, + subject = t) + msg.save() + f3 = 'media/mailbox_attachments/'+f2[6:] + copyfile(f2,f3) + f3 = f3[6:] + a = MessageAttachment(message=msg,document=f3) + a.save() + os.remove(f2) +# job = myqueue( +# queuehigh, +# handle_zip_file, +# r.user.email, +# t, +# f2) messages.info( request,