Merge branch 'release/v10.04'
This commit is contained in:
@@ -4392,6 +4392,7 @@ def workout_toggle_ranking(request,id=0):
|
|||||||
# simple POST API for files on local (e.g. in mailbox)
|
# simple POST API for files on local (e.g. in mailbox)
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def workout_upload_api(request):
|
def workout_upload_api(request):
|
||||||
|
stravaid = 0
|
||||||
if request.method != 'POST':
|
if request.method != 'POST':
|
||||||
message = {'status':'false','message':'this view cannot be accessed through GET'}
|
message = {'status':'false','message':'this view cannot be accessed through GET'}
|
||||||
return JSONResponse(status=403,data=message)
|
return JSONResponse(status=403,data=message)
|
||||||
@@ -4441,6 +4442,11 @@ def workout_upload_api(request):
|
|||||||
message = {'status':'false','message':'could not find file'}
|
message = {'status':'false','message':'could not find file'}
|
||||||
return JSONResponse(status=400,data=message)
|
return JSONResponse(status=400,data=message)
|
||||||
|
|
||||||
|
try:
|
||||||
|
stravaid = post_data['stravaid']
|
||||||
|
except KeyError:
|
||||||
|
stravaid = 0
|
||||||
|
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
t = form.cleaned_data['title']
|
t = form.cleaned_data['title']
|
||||||
boattype = form.cleaned_data['boattype']
|
boattype = form.cleaned_data['boattype']
|
||||||
@@ -4491,6 +4497,10 @@ def workout_upload_api(request):
|
|||||||
return JSONResponse(status=400,data=message)
|
return JSONResponse(status=400,data=message)
|
||||||
|
|
||||||
w = Workout.objects.get(id=id)
|
w = Workout.objects.get(id=id)
|
||||||
|
if stravaid != 0:
|
||||||
|
w.uploadedtostrava = stravaid
|
||||||
|
w.save()
|
||||||
|
|
||||||
|
|
||||||
if make_plot:
|
if make_plot:
|
||||||
res, jobid = uploads.make_plot(r,w,f1,f2,plottype,t)
|
res, jobid = uploads.make_plot(r,w,f1,f2,plottype,t)
|
||||||
@@ -4501,7 +4511,7 @@ def workout_upload_api(request):
|
|||||||
except NoTokenError:
|
except NoTokenError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if upload_to_strava:
|
if upload_to_strava and stravaid == 0:
|
||||||
try:
|
try:
|
||||||
message,id = stravastuff.workout_strava_upload(r.user,w)
|
message,id = stravastuff.workout_strava_upload(r.user,w)
|
||||||
except NoTokenError:
|
except NoTokenError:
|
||||||
|
|||||||
Reference in New Issue
Block a user