initial modality form
This commit is contained in:
@@ -8,7 +8,7 @@ from django.forms.extras.widgets import SelectDateWidget
|
|||||||
from django.utils import timezone,translation
|
from django.utils import timezone,translation
|
||||||
from django.forms import ModelForm
|
from django.forms import ModelForm
|
||||||
import dataprep
|
import dataprep
|
||||||
|
import types
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
# login form
|
# login form
|
||||||
@@ -45,18 +45,6 @@ class StrokeDataForm(forms.Form):
|
|||||||
|
|
||||||
# The form used for uploading files
|
# The form used for uploading files
|
||||||
class DocumentsForm(forms.Form):
|
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)
|
title = forms.CharField(required=False)
|
||||||
file = forms.FileField(required=True,
|
file = forms.FileField(required=True,
|
||||||
validators=[validate_file_extension])
|
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['type_%s' % i].widget.attrs['style'] = 'width:156px; height: 22px;'
|
||||||
self.fields['intervald_%s' % i].widget = forms.TimeInput(format='%H:%M:%S.%f')
|
self.fields['intervald_%s' % i].widget = forms.TimeInput(format='%H:%M:%S.%f')
|
||||||
|
|
||||||
boattypes = (
|
boattypes = types.boattypes
|
||||||
('1x', '1x (single)'),
|
workouttypes = types.workouttypes
|
||||||
('2x', '2x (double)'),
|
|
||||||
('2-', '2- (pair)'),
|
|
||||||
('4x', '4x (quad)'),
|
|
||||||
('4-', '4- (four)'),
|
|
||||||
('8+', '8+ (eight)'),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
# 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
|
# This form sets options for the summary stats page
|
||||||
class StatsOptionsForm(forms.Form):
|
class StatsOptionsForm(forms.Form):
|
||||||
@@ -342,7 +332,6 @@ formaxlabelsmultiflex['workoutid'] = 'Workout'
|
|||||||
parchoicesmultiflex = list(sorted(formaxlabelsmultiflex.items(), key = lambda x:x[1]))
|
parchoicesmultiflex = list(sorted(formaxlabelsmultiflex.items(), key = lambda x:x[1]))
|
||||||
|
|
||||||
from utils import palettes
|
from utils import palettes
|
||||||
#palettechoices = { key:key for key, value in palettes.iteritems() }
|
|
||||||
|
|
||||||
palettechoices = tuple((p,p) for p in palettes.keys())
|
palettechoices = tuple((p,p) for p in palettes.keys())
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import datetime
|
|||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from rowers.rows import validate_file_extension
|
from rowers.rows import validate_file_extension
|
||||||
|
|
||||||
|
import types
|
||||||
|
|
||||||
from rowsandall_app.settings import (
|
from rowsandall_app.settings import (
|
||||||
TWEET_ACCESS_TOKEN_KEY,
|
TWEET_ACCESS_TOKEN_KEY,
|
||||||
TWEET_ACCESS_TOKEN_SECRET,
|
TWEET_ACCESS_TOKEN_SECRET,
|
||||||
@@ -353,53 +355,10 @@ def checkworkoutuser(user,workout):
|
|||||||
|
|
||||||
# Workout
|
# Workout
|
||||||
class Workout(models.Model):
|
class Workout(models.Model):
|
||||||
workouttypes = (
|
workouttypes = types.workouttypes
|
||||||
('water','On-water'),
|
workoutsources = types.workoutsources
|
||||||
('rower','Indoor Rower'),
|
boattypes = types.boattypes
|
||||||
('skierg','Ski Erg'),
|
privacychoices = types.privacychoices
|
||||||
('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'),
|
|
||||||
)
|
|
||||||
|
|
||||||
user = models.ForeignKey(Rower)
|
user = models.ForeignKey(Rower)
|
||||||
team = models.ManyToManyField(Team,blank=True)
|
team = models.ManyToManyField(Team,blank=True)
|
||||||
|
|||||||
@@ -45,22 +45,42 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_12 alpha">
|
<div class="grid_12 alpha">
|
||||||
<div class="grid_4 alpha">
|
<div class="grid_6 alpha">
|
||||||
|
|
||||||
{% if theuser %}
|
{% if theuser %}
|
||||||
<form enctype="multipart/form-data" action="/rowers/user-multiflex-select/user/{{ theuser.id }}/" method="post">
|
<form enctype="multipart/form-data" action="/rowers/user-multiflex-select/user/{{ theuser.id }}/" method="post">
|
||||||
{% else %}
|
{% else %}
|
||||||
<form enctype="multipart/form-data" action="/rowers/user-multiflex-select/" method="post">
|
<form enctype="multipart/form-data" action="/rowers/user-multiflex-select/" method="post">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<div class="grid_4 alpha">
|
||||||
<table>
|
|
||||||
{{ dateform.as_table }}
|
<table>
|
||||||
</table>
|
{{ dateform.as_table }}
|
||||||
{% csrf_token %}
|
</table>
|
||||||
</div>
|
{% csrf_token %}
|
||||||
<div class="grid_2">
|
</div>
|
||||||
<input name='daterange' class="button green" type="submit" value="Submit"> </form>
|
<div class="grid_2 omega">
|
||||||
|
<input name='daterange' class="button green" type="submit" value="Submit">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{% if theuser %}
|
||||||
|
<form enctype="multipart/form-data" action="/rowers/user-multiflex-select/user/{{ theuser.id }}/" method="post">
|
||||||
|
{% else %}
|
||||||
|
<form enctype="multipart/form-data" action="/rowers/user-multiflex-select/" method="post">
|
||||||
|
{% endif %}
|
||||||
|
<div class="grid_4 alpha">
|
||||||
|
|
||||||
|
<table>
|
||||||
|
{{ modalityform.as_table }}
|
||||||
|
</table>
|
||||||
|
{% csrf_token %}
|
||||||
|
</div>
|
||||||
|
<div class="grid_2 omega">
|
||||||
|
<input name='modality' class="button green" type="submit" value="Submit">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="grid_5 prefix_1 omega">
|
<div class="grid_5 prefix_1 omega">
|
||||||
<form id="searchform" action=""
|
<form id="searchform" action=""
|
||||||
method="get" accept-charset="utf-8">
|
method="get" accept-charset="utf-8">
|
||||||
|
|||||||
47
rowers/types.py
Normal file
47
rowers/types.py
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
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'),
|
||||||
|
)
|
||||||
@@ -36,6 +36,7 @@ from rowers.forms import (
|
|||||||
RegistrationFormUniqueEmail,CNsummaryForm,UpdateWindForm,
|
RegistrationFormUniqueEmail,CNsummaryForm,UpdateWindForm,
|
||||||
UpdateStreamForm,WorkoutMultipleCompareForm,ChartParamChoiceForm,
|
UpdateStreamForm,WorkoutMultipleCompareForm,ChartParamChoiceForm,
|
||||||
FusionMetricChoiceForm,BoxPlotChoiceForm,MultiFlexChoiceForm,
|
FusionMetricChoiceForm,BoxPlotChoiceForm,MultiFlexChoiceForm,
|
||||||
|
TrendFlexModalForm,
|
||||||
)
|
)
|
||||||
from rowers.models import Workout, User, Rower, WorkoutForm,FavoriteChart
|
from rowers.models import Workout, User, Rower, WorkoutForm,FavoriteChart
|
||||||
from rowers.models import (
|
from rowers.models import (
|
||||||
@@ -3432,6 +3433,8 @@ def user_multiflex_select(request,
|
|||||||
'includereststrokes':includereststrokes,
|
'includereststrokes':includereststrokes,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
modalityform = TrendFlexModalForm()
|
||||||
|
|
||||||
messages.info(request,successmessage)
|
messages.info(request,successmessage)
|
||||||
messages.error(request,message)
|
messages.error(request,message)
|
||||||
|
|
||||||
@@ -3448,6 +3451,7 @@ def user_multiflex_select(request,
|
|||||||
'theuser':user,
|
'theuser':user,
|
||||||
'form':form,
|
'form':form,
|
||||||
'chartform':chartform,
|
'chartform':chartform,
|
||||||
|
'modalityform':modalityform,
|
||||||
'teams':get_my_teams(request.user),
|
'teams':get_my_teams(request.user),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user