Private
Public Access
1
0

multi compare for pro members

This commit is contained in:
Sander Roosendaal
2017-06-13 22:25:00 +02:00
parent ba7709e6c8
commit 0506eb36aa
2 changed files with 21 additions and 6 deletions

View File

@@ -3156,13 +3156,13 @@ def team_comparison_select(request,
try:
theteam = Team.objects.get(id=teamid)
except Team.DoesNotExist:
raise Http404("Team doesn't exist")
theteam = 0
if theteam.viewing == 'allmembers' or theteam.manager == request.user:
if theteam and (theteam.viewing == 'allmembers' or theteam.manager == request.user):
workouts = Workout.objects.filter(team=theteam,
startdatetime__gte=startdate,
startdatetime__lte=enddate).order_by("-date", "-starttime")
elif theteam.viewing == 'coachonly':
elif theteam and theteam.viewing == 'coachonly':
workouts = Workout.objects.filter(team=theteam,user=r,
startdatetime__gte=startdate,
startdatetime__lte=enddate).order_by("-date","-starttime")
@@ -3187,7 +3187,12 @@ def team_comparison_select(request,
form = WorkoutMultipleCompareForm()
form.fields["workouts"].queryset = workouts
chartform = ChartParamChoiceForm(initial={'teamid':theteam.id})
if theteam:
theid = theteam.id
else:
theid = 0
chartform = ChartParamChoiceForm(initial={'teamid':0})
messages.info(request,successmessage)
messages.error(request,message)