From 866a4123b427e0410554d456a19c20d0917f136c Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Thu, 2 Mar 2017 20:52:10 +0100 Subject: [PATCH] images on comment page --- rowers/views.py | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/rowers/views.py b/rowers/views.py index a025f86e..67715fb1 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -3692,13 +3692,27 @@ def workout_comment_view(request,id=0): return HttpResponseRedirect(url) form = WorkoutCommentForm() - - return render(request, - 'workout_comments.html', - {'workout':w, - 'comments':comments, - 'form':form, - }) + + g = GraphImage.objects.filter(workout=row).order_by("-creationdatetime") + + if (len(g)<=3): + return render(request, + 'workout_comments.html', + {'workout':w, + 'graphs1':g[0:3], + 'comments':comments, + 'form':form, + }) + else: + return render(request, + 'workout_comments.html', + {'workout':w, + 'graphs1':g[0:3], + 'graphs1':g[3:6], + 'comments':comments, + 'form':form, + }) + # The basic edit page @login_required()