chart axes choice on multi compare view
This commit is contained in:
@@ -2057,9 +2057,14 @@ def multi_compare_view(request):
|
||||
r = Rower.objects.get(user=request.user)
|
||||
result = request.user.is_authenticated() and ispromember(request.user)
|
||||
if result:
|
||||
promember=1
|
||||
promember=1
|
||||
|
||||
if request.method == 'POST':
|
||||
if 'ids' in request.session:
|
||||
print request.session['ids']
|
||||
|
||||
print request.POST
|
||||
|
||||
if request.method == 'POST' and 'workouts' in request.POST:
|
||||
form = WorkoutMultipleCompareForm(request.POST)
|
||||
chartform = ChartParamChoiceForm(request.POST)
|
||||
if form.is_valid() and chartform.is_valid():
|
||||
@@ -2070,6 +2075,8 @@ def multi_compare_view(request):
|
||||
plottype = chartform.cleaned_data['plottype']
|
||||
teamid = chartform.cleaned_data['teamid']
|
||||
ids = [int(w.id) for w in workouts]
|
||||
request.session['ids'] = ids
|
||||
|
||||
labeldict = {
|
||||
int(w.id): w.__unicode__() for w in workouts
|
||||
}
|
||||
@@ -2086,9 +2093,40 @@ def multi_compare_view(request):
|
||||
'the_div':div,
|
||||
'promember':promember,
|
||||
'teamid':teamid,
|
||||
'chartform':chartform,
|
||||
})
|
||||
else:
|
||||
return HttpResponse("Form is not valid")
|
||||
if request.method == 'POST' and 'ids' in request.session:
|
||||
chartform = ChartParamChoiceForm(request.POST)
|
||||
if chartform.is_valid():
|
||||
xparam = chartform.cleaned_data['xparam']
|
||||
yparam = chartform.cleaned_data['yparam']
|
||||
plottype = chartform.cleaned_data['plottype']
|
||||
teamid = chartform.cleaned_data['teamid']
|
||||
ids = request.session['ids']
|
||||
request.session['ids'] = ids
|
||||
workouts = [Workout.objects.get(id=id) for id in ids]
|
||||
|
||||
labeldict = {
|
||||
int(w.id): w.__unicode__() for w in workouts
|
||||
}
|
||||
|
||||
res = interactive_multiple_compare_chart(ids,xparam,yparam,
|
||||
promember=promember,
|
||||
plottype=plottype,
|
||||
labeldict=labeldict)
|
||||
script = res[0]
|
||||
div = res[1]
|
||||
|
||||
return render(request,'multicompare.html',
|
||||
{'interactiveplot':script,
|
||||
'the_div':div,
|
||||
'promember':promember,
|
||||
'teamid':teamid,
|
||||
'chartform':chartform,
|
||||
})
|
||||
|
||||
else:
|
||||
url = reverse(workouts_view)
|
||||
return HttpResponseRedirect(url)
|
||||
@@ -5625,8 +5663,6 @@ def rower_teams_view(request,message='',successmessage=''):
|
||||
requests = TeamRequest.objects.filter(user=request.user)
|
||||
myrequests = TeamRequest.objects.filter(team__in=myteams)
|
||||
myinvites = TeamInvite.objects.filter(team__in=myteams)
|
||||
|
||||
print form
|
||||
|
||||
return render(request, 'teams.html',
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user