worked on getting back extrametrics (not fixed)
This commit is contained in:
@@ -957,6 +957,7 @@ class FlexAxesForm(forms.Form):
|
|||||||
choices=yaxchoices2,label='Right Axis',required=True)
|
choices=yaxchoices2,label='Right Axis',required=True)
|
||||||
|
|
||||||
def __init__(self,request,*args,**kwargs):
|
def __init__(self,request,*args,**kwargs):
|
||||||
|
extrametrics = kwargs.pop('extrametrics',[])
|
||||||
super(FlexAxesForm, self).__init__(*args, **kwargs)
|
super(FlexAxesForm, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
rower = Rower.objects.get(user=request.user)
|
rower = Rower.objects.get(user=request.user)
|
||||||
|
|||||||
@@ -8792,13 +8792,18 @@ def workout_flexchart3_view(request,*args,**kwargs):
|
|||||||
workstrokesonly = not includereststrokes
|
workstrokesonly = not includereststrokes
|
||||||
|
|
||||||
flexaxesform = FlexAxesForm(request,request.POST)
|
flexaxesform = FlexAxesForm(request,request.POST)
|
||||||
|
print request.POST
|
||||||
|
|
||||||
if flexaxesform.is_valid():
|
if flexaxesform.is_valid():
|
||||||
|
print 'form valid'
|
||||||
cd = flexaxesform.cleaned_data
|
cd = flexaxesform.cleaned_data
|
||||||
xparam = cd['xaxis']
|
xparam = cd['xaxis']
|
||||||
yparam1 = cd['yaxis1']
|
yparam1 = cd['yaxis1']
|
||||||
yparam2 = cd['yaxis2']
|
yparam2 = cd['yaxis2']
|
||||||
|
else:
|
||||||
|
print flexaxesform.errors
|
||||||
|
|
||||||
|
print xparam,yparam1,yparam2
|
||||||
|
|
||||||
if not promember:
|
if not promember:
|
||||||
for name,d in rowingmetrics:
|
for name,d in rowingmetrics:
|
||||||
@@ -8814,9 +8819,9 @@ def workout_flexchart3_view(request,*args,**kwargs):
|
|||||||
messages.info(request,'To use '+d['verbose_name']+', you have to be Pro member')
|
messages.info(request,'To use '+d['verbose_name']+', you have to be Pro member')
|
||||||
|
|
||||||
# bring back slashes
|
# bring back slashes
|
||||||
yparam1 = yparam1.replace('_slsh_','/')
|
# yparam1 = yparam1.replace('_slsh_','/')
|
||||||
yparam2 = yparam2.replace('_slsh_','/')
|
# yparam2 = yparam2.replace('_slsh_','/')
|
||||||
xparam = xparam.replace('_slsh_','/')
|
# xparam = xparam.replace('_slsh_','/')
|
||||||
|
|
||||||
# create interactive plot
|
# create interactive plot
|
||||||
try:
|
try:
|
||||||
@@ -8878,25 +8883,27 @@ def workout_flexchart3_view(request,*args,**kwargs):
|
|||||||
additionalmetrics = []
|
additionalmetrics = []
|
||||||
|
|
||||||
|
|
||||||
extrametrics = {m.replace('/','_slsh_'):m for m in additionalmetrics}
|
# extrametrics = {m.replace('/','_slsh_'):m for m in additionalmetrics}
|
||||||
|
extrametrics = additionalmetrics
|
||||||
|
|
||||||
xparam = xparam.replace('/','_slsh_')
|
# xparam = xparam.replace('/','_slsh_')
|
||||||
yparam1 = yparam1.replace('/','_slsh_')
|
# yparam1 = yparam1.replace('/','_slsh_')
|
||||||
yparam2 = yparam2.replace('/','_slsh_')
|
# yparam2 = yparam2.replace('/','_slsh_')
|
||||||
|
|
||||||
|
|
||||||
for metric in nometrics:
|
# for metric in nometrics:
|
||||||
try:
|
# try:
|
||||||
extrametrics.pop(metric)
|
# extrametrics.pop(metric)
|
||||||
except KeyError:
|
# except KeyError:
|
||||||
pass
|
# pass
|
||||||
|
|
||||||
initial = {
|
initial = {
|
||||||
'xaxis':xparam,
|
'xaxis':xparam,
|
||||||
'yaxis1':yparam1,
|
'yaxis1':yparam1,
|
||||||
'yaxis2':yparam2
|
'yaxis2':yparam2,
|
||||||
}
|
}
|
||||||
flexaxesform = FlexAxesForm(request,initial=initial)
|
flexaxesform = FlexAxesForm(request,initial=initial,
|
||||||
|
extrametrics=extrametrics)
|
||||||
|
|
||||||
initial = {
|
initial = {
|
||||||
'includereststrokes': not workstrokesonly,
|
'includereststrokes': not workstrokesonly,
|
||||||
|
|||||||
Reference in New Issue
Block a user