Private
Public Access
1
0

added export as ride

This commit is contained in:
Sander Roosendaal
2017-08-31 16:24:05 +02:00
parent 75f50f4de2
commit 71c0a6f5ff
7 changed files with 119 additions and 4 deletions

View File

@@ -43,7 +43,7 @@ from rowers.models import (
RowerPowerForm,RowerForm,GraphImage,AdvancedWorkoutForm,
RowerPowerZonesForm,AccountRowerForm,UserForm,StrokeData,
Team,TeamForm,TeamInviteForm,TeamInvite,TeamRequest,
WorkoutComment,WorkoutCommentForm
WorkoutComment,WorkoutCommentForm,RowerExportForm,
)
from rowers.models import FavoriteForm,BaseFavoriteFormSet,SiteAnnouncement
from django.forms.formsets import formset_factory
@@ -1351,9 +1351,11 @@ def workout_strava_upload_view(request,id=0):
newnotes = w.notes+'\n from '+w.workoutsource+' via rowsandall.com'
except TypeError:
newnotes = 'from '+w.workoutsource+' via rowsandall.com'
activity_type = r.stravaexportas
res,mes = stravastuff.handle_stravaexport(f,w.name,
r.stravatoken,
description=newnotes)
description=newnotes,
activity_type=activity_type)
if res==0:
messages.error(request,mes)
w.uploadedtostrava = -1
@@ -8463,6 +8465,24 @@ def rower_favoritecharts_view(request):
return render(request,'favoritecharts.html',context)
# page where user sets his export settings
@login_required()
def rower_exportsettings_view(request):
r = getrower(request.user)
if request.method == 'POST':
form = RowerExportForm(request.POST)
if form.is_valid():
stravaexportas = form.cleaned_data['stravaexportas']
r.stravaexportas = stravaexportas
r.save()
else:
form = RowerExportForm(instance=r)
return render(request, 'rower_exportsettings.html',
{'form':form,
'rower':r,
})
# Page where user can set his details
# Add email address to form so user can change his email address
@login_required()