added number of comments to workout_view
This commit is contained in:
@@ -4457,6 +4457,11 @@ def workout_view(request,id=0):
|
||||
try:
|
||||
# check if valid ID exists (workout exists)
|
||||
row = Workout.objects.get(id=id)
|
||||
comments = WorkoutComment.objects.filter(workout=row)
|
||||
|
||||
aantalcomments = len(comments)
|
||||
|
||||
|
||||
if row.privacy == 'private':
|
||||
raise Http404("Not allowed to view this workout")
|
||||
|
||||
@@ -4479,6 +4484,7 @@ def workout_view(request,id=0):
|
||||
'last_name':u.last_name,
|
||||
'first_name':u.first_name,
|
||||
'interactiveplot':script,
|
||||
'aantalcomments':aantalcomments,
|
||||
'teams':get_my_teams(request.user),
|
||||
'the_div':div})
|
||||
else:
|
||||
@@ -4489,6 +4495,7 @@ def workout_view(request,id=0):
|
||||
'last_name':u.last_name,
|
||||
'first_name':u.first_name,
|
||||
'teams':get_my_teams(request.user),
|
||||
'aantalcomments':aantalcomments,
|
||||
'interactiveplot':script,
|
||||
'the_div':div})
|
||||
|
||||
@@ -6200,6 +6207,10 @@ def workout_edit_view(request,id=0,message="",successmessage=""):
|
||||
g = GraphImage.objects.filter(workout=row).order_by("-creationdatetime")
|
||||
# check if user is owner of this workout
|
||||
|
||||
comments = WorkoutComment.objects.filter(workout=row)
|
||||
|
||||
aantalcomments = len(comments)
|
||||
|
||||
if (checkworkoutuser(request.user,row)==False):
|
||||
raise Http404("You are not allowed to edit this workout")
|
||||
|
||||
@@ -6245,6 +6256,7 @@ def workout_edit_view(request,id=0,message="",successmessage=""):
|
||||
'teams':get_my_teams(request.user),
|
||||
'graphs1':g[0:3],
|
||||
'mapscript':mapscript,
|
||||
'aantalcomments':aantalcomments,
|
||||
'mapdiv':mapdiv,
|
||||
})
|
||||
|
||||
@@ -6256,6 +6268,7 @@ def workout_edit_view(request,id=0,message="",successmessage=""):
|
||||
'graphs1':g[0:3],
|
||||
'graphs2':g[3:6],
|
||||
'mapscript':mapscript,
|
||||
'aantalcomments':aantalcomments,
|
||||
'mapdiv':mapdiv,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user