diff --git a/rowers/forms.py b/rowers/forms.py index e64014aa..910b6ce5 100644 --- a/rowers/forms.py +++ b/rowers/forms.py @@ -8,7 +8,7 @@ from django.forms.extras.widgets import SelectDateWidget from django.utils import timezone,translation from django.forms import ModelForm import dataprep - +import types import datetime # login form @@ -45,18 +45,6 @@ class StrokeDataForm(forms.Form): # The form used for uploading files class DocumentsForm(forms.Form): - filetypechoices = ( - ('csv' , 'Painsled iOS CSV'), - ('tcx' , 'TCX'), - ('tcxnohr' , 'TCX No HR'), - ('rp' , 'RowPro CSV'), - ('speedcoach' , 'SpeedCoach GPS CSV'), - ('speedcoach2' , 'SpeedCoach GPS 2 CSV'), - ('ergdata' , 'ErgData CSV'), - ('ergstick' , 'ErgStick CSV'), - ('painsleddesktop' , 'Painsled Desktop CSV'), - ('zip','Zipped file'), - ) title = forms.CharField(required=False) file = forms.FileField(required=True, validators=[validate_file_extension]) @@ -275,15 +263,17 @@ class IntervalUpdateForm(forms.Form): self.fields['type_%s' % i].widget.attrs['style'] = 'width:156px; height: 22px;' self.fields['intervald_%s' % i].widget = forms.TimeInput(format='%H:%M:%S.%f') -boattypes = ( - ('1x', '1x (single)'), - ('2x', '2x (double)'), - ('2-', '2- (pair)'), - ('4x', '4x (quad)'), - ('4-', '4- (four)'), - ('8+', '8+ (eight)'), -) +boattypes = types.boattypes +workouttypes = types.workouttypes +# form to select modality and boat type for trend flex +class TrendFlexModalForm(forms.Form): + modality = forms.ChoiceField(choices=workouttypes, + label='Workout Type') + waterboattype = forms.MultipleChoiceField(choices=boattypes, + label='Water Boat Type', + initial = ['1x','2x','2-','4x','4-','8+']) + # This form sets options for the summary stats page class StatsOptionsForm(forms.Form): @@ -342,7 +332,6 @@ formaxlabelsmultiflex['workoutid'] = 'Workout' parchoicesmultiflex = list(sorted(formaxlabelsmultiflex.items(), key = lambda x:x[1])) from utils import palettes -#palettechoices = { key:key for key, value in palettes.iteritems() } palettechoices = tuple((p,p) for p in palettes.keys()) diff --git a/rowers/models.py b/rowers/models.py index e880ca24..011eb585 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -22,6 +22,8 @@ import datetime from django.core.exceptions import ValidationError from rowers.rows import validate_file_extension +import types + from rowsandall_app.settings import ( TWEET_ACCESS_TOKEN_KEY, TWEET_ACCESS_TOKEN_SECRET, @@ -353,53 +355,10 @@ def checkworkoutuser(user,workout): # Workout class Workout(models.Model): - workouttypes = ( - ('water','On-water'), - ('rower','Indoor Rower'), - ('skierg','Ski Erg'), - ('dynamic','Dynamic Indoor Rower'), - ('slides','Indoor Rower on Slides'), - ('paddle','Paddle Adapter'), - ('snow','On-snow'), - ('coastal','Coastal'), - ('other','Other'), - ) - - workoutsources = ( - ('strava','strava'), - ('concept2','concept2'), - ('sporttracks','sporttracks'), - ('runkeeper','runkeeper'), - ('mapmyfitness','mapmyfitness'), - ('csv','painsled'), - ('tcx','tcx'), - ('rp','rp'), - ('mystery','mystery'), - ('tcxnohr','tcx (no HR)'), - ('rowperfect3','rowperfect3'), - ('ergdata','ergdata'), - ('boatcoach','boatcoach'), - ('bcmike','boatcoach (develop)'), - ('painsleddesktop','painsleddesktop'), - ('speedcoach','speedcoach'), - ('speedcoach2','speedcoach2'), - ('ergstick','ergstick'), - ('fit','fit'), - ('unknown','unknown')) - - boattypes = ( - ('1x', '1x (single)'), - ('2x', '2x (double)'), - ('2-', '2- (pair)'), - ('4x', '4x (quad)'), - ('4-', '4- (four)'), - ('8+', '8+ (eight)'), - ) - - privacychoices = ( - ('private','Private'), - ('visible','Visible'), - ) + workouttypes = types.workouttypes + workoutsources = types.workoutsources + boattypes = types.boattypes + privacychoices = types.privacychoices user = models.ForeignKey(Rower) team = models.ManyToManyField(Team,blank=True) diff --git a/rowers/templates/user_multiflex_select.html b/rowers/templates/user_multiflex_select.html index 0b0b8642..06db28ce 100644 --- a/rowers/templates/user_multiflex_select.html +++ b/rowers/templates/user_multiflex_select.html @@ -45,22 +45,42 @@