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.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())
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -45,22 +45,42 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_12 alpha">
|
||||
<div class="grid_4 alpha">
|
||||
|
||||
<div class="grid_6 alpha">
|
||||
{% 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 %}
|
||||
|
||||
<table>
|
||||
{{ dateform.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
</div>
|
||||
<div class="grid_2">
|
||||
<input name='daterange' class="button green" type="submit" value="Submit"> </form>
|
||||
{% else %}
|
||||
<form enctype="multipart/form-data" action="/rowers/user-multiflex-select/" method="post">
|
||||
{% endif %}
|
||||
<div class="grid_4 alpha">
|
||||
|
||||
<table>
|
||||
{{ dateform.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
</div>
|
||||
<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 class="grid_5 prefix_1 omega">
|
||||
<form id="searchform" action=""
|
||||
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,
|
||||
UpdateStreamForm,WorkoutMultipleCompareForm,ChartParamChoiceForm,
|
||||
FusionMetricChoiceForm,BoxPlotChoiceForm,MultiFlexChoiceForm,
|
||||
TrendFlexModalForm,
|
||||
)
|
||||
from rowers.models import Workout, User, Rower, WorkoutForm,FavoriteChart
|
||||
from rowers.models import (
|
||||
@@ -3432,6 +3433,8 @@ def user_multiflex_select(request,
|
||||
'includereststrokes':includereststrokes,
|
||||
})
|
||||
|
||||
modalityform = TrendFlexModalForm()
|
||||
|
||||
messages.info(request,successmessage)
|
||||
messages.error(request,message)
|
||||
|
||||
@@ -3448,6 +3451,7 @@ def user_multiflex_select(request,
|
||||
'theuser':user,
|
||||
'form':form,
|
||||
'chartform':chartform,
|
||||
'modalityform':modalityform,
|
||||
'teams':get_my_teams(request.user),
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user