flexall using form
This commit is contained in:
@@ -7,12 +7,38 @@ from django.contrib.auth.models import User
|
|||||||
from django.contrib.admin.widgets import AdminDateWidget
|
from django.contrib.admin.widgets import AdminDateWidget
|
||||||
from django.forms.extras.widgets import SelectDateWidget
|
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, Select
|
||||||
import dataprep
|
import dataprep
|
||||||
import types
|
import types
|
||||||
import datetime
|
import datetime
|
||||||
from django.forms import formset_factory
|
from django.forms import formset_factory
|
||||||
from utils import landingpages
|
from utils import landingpages
|
||||||
|
from metrics import axes
|
||||||
|
|
||||||
|
class SelectWidget(Select):
|
||||||
|
"""
|
||||||
|
Subclass of Django's select widget that allows disabling options.
|
||||||
|
"""
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
self._disabled_choices = []
|
||||||
|
super(SelectWidget, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def disabled_choices(self):
|
||||||
|
return self._disabled_choices
|
||||||
|
|
||||||
|
@disabled_choices.setter
|
||||||
|
def disabled_choices(self, other):
|
||||||
|
self._disabled_choices = other
|
||||||
|
|
||||||
|
def create_option(self, name, value, label, selected, index, subindex=None, attrs=None):
|
||||||
|
option_dict = super(SelectWidget, self).create_option(
|
||||||
|
name, value, label, selected, index, subindex=subindex, attrs=attrs
|
||||||
|
)
|
||||||
|
if value in self.disabled_choices:
|
||||||
|
option_dict['attrs']['disabled'] = 'disabled'
|
||||||
|
|
||||||
|
return option_dict
|
||||||
|
|
||||||
# login form
|
# login form
|
||||||
class LoginForm(forms.Form):
|
class LoginForm(forms.Form):
|
||||||
@@ -29,6 +55,7 @@ class EmailForm(forms.Form):
|
|||||||
message = forms.CharField()
|
message = forms.CharField()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Upload the CrewNerd Summary CSV
|
# Upload the CrewNerd Summary CSV
|
||||||
class CNsummaryForm(forms.Form):
|
class CNsummaryForm(forms.Form):
|
||||||
file = forms.FileField(required=True,validators=[must_be_csv])
|
file = forms.FileField(required=True,validators=[must_be_csv])
|
||||||
@@ -919,3 +946,59 @@ class VirtualRaceSelectForm(forms.Form):
|
|||||||
self.fields['country'] = forms.ChoiceField(
|
self.fields['country'] = forms.ChoiceField(
|
||||||
choices = get_countries(),initial='All'
|
choices = get_countries(),initial='All'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class FlexAxesForm(forms.Form):
|
||||||
|
axchoices = (
|
||||||
|
(ax[0],ax[1]) for ax in axes if ax[0] not in ['cumdist','None']
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
yaxchoices = (
|
||||||
|
(ax[0], ax[1]) for ax in axes if ax[0] not in ['cumdist','distance','time']
|
||||||
|
)
|
||||||
|
|
||||||
|
yaxchoices2 = (
|
||||||
|
(ax[0], ax[1]) for ax in axes if ax[0] not in ['cumdist','distance','time']
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
xaxis = forms.ChoiceField(
|
||||||
|
choices=axchoices,label='X-Axis',widget=SelectWidget,required=True)
|
||||||
|
yaxis1 = forms.ChoiceField(
|
||||||
|
choices=yaxchoices,label='Left Axis',widget=SelectWidget,required=True)
|
||||||
|
yaxis2 = forms.ChoiceField(
|
||||||
|
choices=yaxchoices2,label='Right Axis',widget=SelectWidget,required=True)
|
||||||
|
|
||||||
|
def __init__(self,request,*args,**kwargs):
|
||||||
|
super(FlexAxesForm, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
rower = Rower.objects.get(user=request.user)
|
||||||
|
|
||||||
|
axchoicespro = (
|
||||||
|
('',ax[1]) if ax[4] == 'pro' and ax[0] else (ax[0],ax[1]) for ax in axes
|
||||||
|
)
|
||||||
|
|
||||||
|
axchoicesbasicx = []
|
||||||
|
axchoicesbasicy = []
|
||||||
|
|
||||||
|
for ax in axes:
|
||||||
|
if ax[4] != 'pro' and ax[0] != 'cumdist':
|
||||||
|
if ax[0] != 'None':
|
||||||
|
axchoicesbasicx.insert(0,(ax[0],ax[1]))
|
||||||
|
if ax[0] not in ['cumdist','distance','time']:
|
||||||
|
axchoicesbasicy.insert(0,(ax[0],ax[1]))
|
||||||
|
else:
|
||||||
|
if ax[0] != 'None':
|
||||||
|
axchoicesbasicx.insert(0,('None',ax[1]+' (PRO)'))
|
||||||
|
if ax[0] not in ['cumdist','distance','time']:
|
||||||
|
axchoicesbasicy.insert(0,('None',ax[1]+' (PRO)'))
|
||||||
|
|
||||||
|
|
||||||
|
if rower.rowerplan == 'basic':
|
||||||
|
self.fields['xaxis'].choices = axchoicesbasicx
|
||||||
|
self.fields['yaxis1'].choices = axchoicesbasicy
|
||||||
|
self.fields['yaxis2'].choices = axchoicesbasicy
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2803,6 +2803,8 @@ def interactive_cum_flex_chart2(theworkouts,promember=0,
|
|||||||
),
|
),
|
||||||
plot])
|
plot])
|
||||||
|
|
||||||
|
layout.sizing_mode = 'scale_width'
|
||||||
|
|
||||||
script, div = components(layout)
|
script, div = components(layout)
|
||||||
js_resources = INLINE.render_js()
|
js_resources = INLINE.render_js()
|
||||||
css_resources = INLINE.render_css()
|
css_resources = INLINE.render_css()
|
||||||
@@ -3002,8 +3004,6 @@ def interactive_flex_chart2(id=0,promember=0,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
sizing_mode = 'fixed' # 'scale_width' also looks nice with this example
|
|
||||||
|
|
||||||
plot = Figure(x_axis_type=x_axis_type,y_axis_type=y_axis_type,
|
plot = Figure(x_axis_type=x_axis_type,y_axis_type=y_axis_type,
|
||||||
tools=TOOLS,
|
tools=TOOLS,
|
||||||
toolbar_sticky=False
|
toolbar_sticky=False
|
||||||
|
|||||||
@@ -81,147 +81,40 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="main-content">
|
<ul class="main-content">
|
||||||
<li class="grid_2">
|
|
||||||
<form enctype="multipart/form-data" action="{{ formloc }}" method="post">
|
|
||||||
{% csrf_token %}
|
|
||||||
|
|
||||||
<table>
|
<li class="grid_4">
|
||||||
{{ optionsform.as_table }}
|
|
||||||
</table>
|
|
||||||
<input type="hidden" name="options" value="options">
|
|
||||||
<input class="button green small" value="Submit" type="Submit">
|
|
||||||
</form>
|
|
||||||
</li>
|
|
||||||
<li class="grid_2">
|
|
||||||
<p>Use this form to select a different date range:</p>
|
|
||||||
<p>
|
|
||||||
Select start and end date for a date range:
|
|
||||||
<form enctype="multipart/form-data" action="" method="post">
|
|
||||||
|
|
||||||
<table>
|
|
||||||
{{ form.as_table }}
|
|
||||||
</table>
|
|
||||||
{% csrf_token %}
|
|
||||||
<input name='daterange' class="button green" type="submit" value="Submit">
|
|
||||||
</form>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
|
|
||||||
<li>
|
|
||||||
<p>Summary for {{ theuser.first_name }} {{ theuser.last_name }}
|
<p>Summary for {{ theuser.first_name }} {{ theuser.last_name }}
|
||||||
between {{ startdate|date }} and {{ enddate|date }}</p>
|
between {{ startdate|date }} and {{ enddate|date }}</p>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
|
||||||
<ul class="cd-accordion-menu animated">
|
|
||||||
<li class="has-children" id="xaxis">
|
|
||||||
<input type="checkbox" name="group-x" id="group-x">
|
|
||||||
<label for="group-x">
|
|
||||||
X-Axis
|
|
||||||
</label>
|
|
||||||
<ul>
|
|
||||||
{% for key, value in axchoicesbasic.items %}
|
|
||||||
{% if key != 'None' %}
|
|
||||||
<li>
|
|
||||||
<a href="/rowers/flexall/{{ key }}/{{ yparam1 }}/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}/">{{ value }}</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% if promember %}
|
|
||||||
{% for key, value in axchoicespro.items %}
|
|
||||||
<li>
|
|
||||||
<a href="/rowers/flexall/{{ key }}/{{ yparam1 }}/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}/">{{ value }}</a>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
{% else %}
|
|
||||||
{% for key, value in axchoicespro.items %}
|
|
||||||
<li>
|
|
||||||
<a href="/rowers/promembership">{{ value }}</a>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<ul class="cd-accordion-menu animated">
|
|
||||||
<li class="has-children" id="yparam1">
|
|
||||||
<input type="checkbox" name="group-y1" id="group-y1">
|
|
||||||
<label for="group-y1">
|
|
||||||
Left
|
|
||||||
</label>
|
|
||||||
<ul>
|
|
||||||
{% for key, value in axchoicesbasic.items %}
|
|
||||||
{% if key not in noylist and key != 'None' %}
|
|
||||||
<li>
|
|
||||||
<a href="/rowers/flexall/{{ xparam }}/{{ key }}/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}/">{{ value }}</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% if promember %}
|
|
||||||
{% for key, value in axchoicespro.items %}
|
|
||||||
{% if key not in noylist %}
|
|
||||||
<li>
|
|
||||||
<a href="/rowers/flexall/{{ xparam }}/{{ key }}/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}/">{{ value }}</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% else %}
|
|
||||||
{% for key, value in axchoicespro.items %}
|
|
||||||
{% if key not in noylist %}
|
|
||||||
<li>
|
|
||||||
<a href="/rowers/promembership">{{ value }}</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<ul class="cd-accordion-menu animated">
|
|
||||||
<li class="has-children" id="yparam2">
|
|
||||||
<input type="checkbox" name="group-y2" id="group-y2">
|
|
||||||
<label for="group-y2">
|
|
||||||
Right
|
|
||||||
</label>
|
|
||||||
<ul>
|
|
||||||
{% for key, value in axchoicesbasic.items %}
|
|
||||||
{% if key not in noylist and key != 'None' %}
|
|
||||||
<li>
|
|
||||||
<a href="/rowers/flexall/{{ xparam }}/{{ yparam1 }}/{{ key }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}/">{{ value }}</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% if promember %}
|
|
||||||
{% for key, value in axchoicespro.items %}
|
|
||||||
{% if key not in noylist %}
|
|
||||||
<li>
|
|
||||||
<a href="/rowers/flexall/{{ xparam }}/{{ yparam1 }}/{{ key }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}/">{{ value }}</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% else %}
|
|
||||||
{% for key, value in axchoicespro.items %}
|
|
||||||
{% if key not in noylist %}
|
|
||||||
<li>
|
|
||||||
<a href="/rowers/promembership">{{ value }}</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li class="grid_4">
|
<li class="grid_4">
|
||||||
<div id="id_chart">
|
<div id="id_chart">
|
||||||
|
|
||||||
{{ the_div|safe }}
|
{{ the_div|safe }}
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<form enctype="multipart/form-data" action="{{ formloc }}" method="post">
|
||||||
|
<table>
|
||||||
|
{{ optionsform.as_table }}
|
||||||
|
</table>
|
||||||
|
<input type="hidden" name="options" value="options">
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<table>
|
||||||
|
{{ form.as_table }}
|
||||||
|
</table>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<table>
|
||||||
|
{{ flexaxesform.as_table }}
|
||||||
|
</table>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
{% csrf_token %}
|
||||||
|
<input class="button green small" value="Submit" type="Submit">
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
131
rowers/views.py
131
rowers/views.py
@@ -43,7 +43,7 @@ from rowers.forms import (
|
|||||||
LandingPageForm,PlannedSessionSelectForm,WorkoutSessionSelectForm,
|
LandingPageForm,PlannedSessionSelectForm,WorkoutSessionSelectForm,
|
||||||
PlannedSessionTeamForm,PlannedSessionTeamMemberForm,
|
PlannedSessionTeamForm,PlannedSessionTeamMemberForm,
|
||||||
VirtualRaceSelectForm,WorkoutRaceSelectForm,CourseSelectForm,
|
VirtualRaceSelectForm,WorkoutRaceSelectForm,CourseSelectForm,
|
||||||
RaceResultFilterForm,PowerIntervalUpdateForm
|
RaceResultFilterForm,PowerIntervalUpdateForm,FlexAxesForm,
|
||||||
)
|
)
|
||||||
from django.core.urlresolvers import reverse, reverse_lazy
|
from django.core.urlresolvers import reverse, reverse_lazy
|
||||||
|
|
||||||
@@ -2448,6 +2448,12 @@ def histo_all(request,theuser=0,
|
|||||||
'teams':get_my_teams(request.user),
|
'teams':get_my_teams(request.user),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
def keyvalue_get_default(key,options,def_options):
|
||||||
|
try:
|
||||||
|
return options[key]
|
||||||
|
except KeyError:
|
||||||
|
return def_options[key]
|
||||||
|
|
||||||
# The Flex plot for a large selection of workouts
|
# The Flex plot for a large selection of workouts
|
||||||
@login_required()
|
@login_required()
|
||||||
def cum_flex_data(
|
def cum_flex_data(
|
||||||
@@ -2468,37 +2474,21 @@ def cum_flex_data(
|
|||||||
|
|
||||||
def_options = options
|
def_options = options
|
||||||
|
|
||||||
|
|
||||||
if 'options' in request.session:
|
if 'options' in request.session:
|
||||||
options = request.session['options']
|
options = request.session['options']
|
||||||
|
|
||||||
try:
|
modality = keyvalue_get_default('modality',options,def_options)
|
||||||
modality = options['modality']
|
rankingonly = keyvalue_get_default('rankingonly',options,def_options)
|
||||||
rankingonly = options['rankingonly']
|
includereststrokes = keyvalue_get_default('includereststrokes',options,def_options)
|
||||||
includereststrokes = options['includereststrokes']
|
waterboattype = keyvalue_get_default('waterboattype',options,def_options)
|
||||||
waterboattype = options['waterboattype']
|
workstrokesonly = not includereststrokes
|
||||||
workstrokesonly = not includereststrokes
|
theuser = keyvalue_get_default('theuser',options,def_options)
|
||||||
theuser = options['theuser']
|
xparam = keyvalue_get_default('xparam',options,def_options)
|
||||||
xparam = options['xparam']
|
yparam1 = keyvalue_get_default('yparam1',options,def_options)
|
||||||
yparam1 = options['yparam1']
|
yparam2 = keyvalue_get_default('yparam2',options,def_options)
|
||||||
yparam2 = options['yparam2']
|
startdatestring = keyvalue_get_default('startdatestring',options,def_options)
|
||||||
startdatestring = options['startdatestring']
|
enddatestring = keyvalue_get_default('enddatestring',options,def_options)
|
||||||
enddatestring = options['enddatestring']
|
|
||||||
deltadays = options['deltadays']
|
|
||||||
except KeyError:
|
|
||||||
modality = def_options['modality']
|
|
||||||
rankingonly = def_options['rankingonly']
|
|
||||||
includereststrokes = def_options['includereststrokes']
|
|
||||||
waterboattype = def_options['waterboattype']
|
|
||||||
workstrokesonly = not includereststrokes
|
|
||||||
theuser = def_options['theuser']
|
|
||||||
xparam = def_options['xparam']
|
|
||||||
yparam1 = def_options['yparam1']
|
|
||||||
yparam2 = def_options['yparam2']
|
|
||||||
startdatestring = def_options['startdatestring']
|
|
||||||
enddatestring = def_options['enddatestring']
|
|
||||||
deltadays = def_options['deltadays']
|
|
||||||
request.session['options'] = def_options
|
|
||||||
|
|
||||||
|
|
||||||
if modality == 'all':
|
if modality == 'all':
|
||||||
modalities = [m[0] for m in types.workouttypes]
|
modalities = [m[0] for m in types.workouttypes]
|
||||||
@@ -2515,9 +2505,6 @@ def cum_flex_data(
|
|||||||
except ParseError:
|
except ParseError:
|
||||||
enddate = timezone.now()
|
enddate = timezone.now()
|
||||||
|
|
||||||
if deltadays>0:
|
|
||||||
startdate = enddate-datetime.timedelta(days=int(deltadays))
|
|
||||||
|
|
||||||
|
|
||||||
if enddate < startdate:
|
if enddate < startdate:
|
||||||
s = enddate
|
s = enddate
|
||||||
@@ -2648,10 +2635,10 @@ def cum_flex(request,theuser=0,
|
|||||||
# get all indoor rows of in date range
|
# get all indoor rows of in date range
|
||||||
|
|
||||||
# process form
|
# process form
|
||||||
if request.method == 'POST' and "daterange" in request.POST:
|
if request.method == 'POST':
|
||||||
form = DateRangeForm(request.POST)
|
form = DateRangeForm(request.POST)
|
||||||
deltaform = DeltaDaysForm(request.POST)
|
modalityform = TrendFlexModalForm(request.POST)
|
||||||
optionsform = StatsOptionsForm()
|
flexaxesform = FlexAxesForm(request,request.POST)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
startdate = form.cleaned_data['startdate']
|
startdate = form.cleaned_data['startdate']
|
||||||
enddate = form.cleaned_data['enddate']
|
enddate = form.cleaned_data['enddate']
|
||||||
@@ -2659,27 +2646,6 @@ def cum_flex(request,theuser=0,
|
|||||||
s = enddate
|
s = enddate
|
||||||
enddate = startdate
|
enddate = startdate
|
||||||
startdate = s
|
startdate = s
|
||||||
elif request.method == 'POST' and "datedelta" in request.POST:
|
|
||||||
deltaform = DeltaDaysForm(request.POST)
|
|
||||||
optionsform = TrendFlexModalForm()
|
|
||||||
if deltaform.is_valid():
|
|
||||||
deltadays = deltaform.cleaned_data['deltadays']
|
|
||||||
if deltadays != 0 and isinstance(deltadays, Number):
|
|
||||||
enddate = timezone.now()
|
|
||||||
startdate = enddate-datetime.timedelta(days=deltadays)
|
|
||||||
if startdate > enddate:
|
|
||||||
s = enddate
|
|
||||||
enddate = startdate
|
|
||||||
startdate = s
|
|
||||||
form = DateRangeForm(initial={
|
|
||||||
'startdate': startdate,
|
|
||||||
'enddate': enddate,
|
|
||||||
})
|
|
||||||
else:
|
|
||||||
form = DateRangeForm()
|
|
||||||
optionsform = TrendFlexModalForm()
|
|
||||||
elif request.method == 'POST' and 'options' in request.POST:
|
|
||||||
modalityform = TrendFlexModalForm(request.POST)
|
|
||||||
if modalityform.is_valid():
|
if modalityform.is_valid():
|
||||||
modality = modalityform.cleaned_data['modality']
|
modality = modalityform.cleaned_data['modality']
|
||||||
waterboattype = modalityform.cleaned_data['waterboattype']
|
waterboattype = modalityform.cleaned_data['waterboattype']
|
||||||
@@ -2700,29 +2666,37 @@ def cum_flex(request,theuser=0,
|
|||||||
'startdate': startdate,
|
'startdate': startdate,
|
||||||
'enddate': enddate,
|
'enddate': enddate,
|
||||||
})
|
})
|
||||||
deltaform = DeltaDaysForm()
|
if flexaxesform.is_valid():
|
||||||
else:
|
xparam = flexaxesform.cleaned_data['xaxis']
|
||||||
form = DateRangeForm(initial={
|
yparam1 = flexaxesform.cleaned_data['yaxis1']
|
||||||
'startdate': startdate,
|
yparam2 = flexaxesform.cleaned_data['yaxis2']
|
||||||
'enddate': enddate,
|
|
||||||
})
|
|
||||||
deltaform = DeltaDaysForm()
|
|
||||||
else:
|
else:
|
||||||
form = DateRangeForm(initial={
|
form = DateRangeForm(initial={
|
||||||
'startdate': startdate,
|
'startdate': startdate,
|
||||||
'enddate': enddate,
|
'enddate': enddate,
|
||||||
})
|
})
|
||||||
deltaform = DeltaDaysForm()
|
includereststrokes = False
|
||||||
modalityform = TrendFlexModalForm()
|
|
||||||
|
workstrokesonly = not includereststrokes
|
||||||
|
modalityform = TrendFlexModalForm(
|
||||||
|
initial={
|
||||||
|
'modality':modality,
|
||||||
|
'waterboattype':waterboattype,
|
||||||
|
'rankingonly':rankingonly,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
initial = {
|
||||||
|
'xaxis':xparam,
|
||||||
|
'yaxis1':yparam1,
|
||||||
|
'yaxis2':yparam2
|
||||||
|
}
|
||||||
|
flexaxesform = FlexAxesForm(request,initial=initial)
|
||||||
|
|
||||||
negtypes = []
|
negtypes = []
|
||||||
for b in types.boattypes:
|
for b in types.boattypes:
|
||||||
if b[0] not in waterboattype:
|
if b[0] not in waterboattype:
|
||||||
negtypes.append(b[0])
|
negtypes.append(b[0])
|
||||||
|
|
||||||
includereststrokes = False
|
|
||||||
|
|
||||||
workstrokesonly = not includereststrokes
|
|
||||||
|
|
||||||
|
|
||||||
script = ''
|
script = ''
|
||||||
@@ -2730,21 +2704,8 @@ def cum_flex(request,theuser=0,
|
|||||||
js_resources = ''
|
js_resources = ''
|
||||||
css_resources = ''
|
css_resources = ''
|
||||||
|
|
||||||
axchoicesbasic = {ax[0]:ax[1] for ax in axes if ax[4]=='basic'}
|
|
||||||
axchoicespro = {ax[0]:ax[1] for ax in axes if ax[4]=='pro'}
|
|
||||||
noylist = ["time","distance"]
|
|
||||||
axchoicesbasic.pop("cumdist")
|
|
||||||
|
|
||||||
|
|
||||||
modalityform = TrendFlexModalForm(
|
|
||||||
initial={
|
|
||||||
'modality':modality,
|
|
||||||
'waterboattype':waterboattype,
|
|
||||||
'rankingonly':rankingonly,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
'xparam': xparam,
|
'xparam': xparam,
|
||||||
@@ -2755,7 +2716,6 @@ def cum_flex(request,theuser=0,
|
|||||||
'waterboattype':waterboattype,
|
'waterboattype':waterboattype,
|
||||||
'startdatestring':startdatestring,
|
'startdatestring':startdatestring,
|
||||||
'enddatestring':enddatestring,
|
'enddatestring':enddatestring,
|
||||||
'deltadays':deltadays,
|
|
||||||
'rankingonly':rankingonly,
|
'rankingonly':rankingonly,
|
||||||
'includereststrokes':includereststrokes,
|
'includereststrokes':includereststrokes,
|
||||||
}
|
}
|
||||||
@@ -2786,15 +2746,12 @@ def cum_flex(request,theuser=0,
|
|||||||
'enddate':enddate,
|
'enddate':enddate,
|
||||||
'form':form,
|
'form':form,
|
||||||
'optionsform':modalityform,
|
'optionsform':modalityform,
|
||||||
'deltaform':deltaform,
|
|
||||||
'xparam':xparam,
|
'xparam':xparam,
|
||||||
'yparam1':yparam1,
|
'yparam1':yparam1,
|
||||||
'yparam2':yparam2,
|
'yparam2':yparam2,
|
||||||
'promember':promember,
|
'promember':promember,
|
||||||
'teams':get_my_teams(request.user),
|
'teams':get_my_teams(request.user),
|
||||||
'axchoicesbasic':axchoicesbasic,
|
'flexaxesform':flexaxesform,
|
||||||
'axchoicespro':axchoicespro,
|
|
||||||
'noylist':noylist,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user