diff --git a/rowers/templates/workout_form.html b/rowers/templates/workout_form.html index 87eb4b26..3a48dac7 100644 --- a/rowers/templates/workout_form.html +++ b/rowers/templates/workout_form.html @@ -59,7 +59,7 @@ Comments - Comment + Comment ({{ aantalcomments }}) diff --git a/rowers/templates/workout_view.html b/rowers/templates/workout_view.html index 938fd7d2..57847372 100644 --- a/rowers/templates/workout_view.html +++ b/rowers/templates/workout_view.html @@ -33,7 +33,7 @@ Comments - Comment + Comment ({{ aantalcomments }}) {% endif %} diff --git a/rowers/views.py b/rowers/views.py index 49e17ed2..3cda06e0 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -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, })