From b20381be9d8d4b28ed9af566df3dca152fd4ec14 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Mon, 16 Dec 2019 17:25:24 +0100 Subject: [PATCH] coaches can edit video analysis --- rowers/templates/embedded_video.html | 4 ++-- rowers/views/workoutviews.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/rowers/templates/embedded_video.html b/rowers/templates/embedded_video.html index 789eb3c5..298577e6 100644 --- a/rowers/templates/embedded_video.html +++ b/rowers/templates/embedded_video.html @@ -306,7 +306,7 @@ function copyText() { } - {% if user.is_authenticated and user == workout.user.user %} + {% if user.is_authenticated and workout|may_edit:request %}
  • Lock Data and Video
  • @@ -322,7 +322,7 @@ function copyText() {
  • - {% if form and user.is_authenticated and user == workout.user.user %} + {% if form and user.is_authenticated and workout|may_edit:request %} {{ form.as_table }} diff --git a/rowers/views/workoutviews.py b/rowers/views/workoutviews.py index 6e7b8545..e113f19d 100644 --- a/rowers/views/workoutviews.py +++ b/rowers/views/workoutviews.py @@ -172,6 +172,9 @@ def workout_video_create_view(request,id=0): else: mode = 'erg' + + mayedit = checkworkoutuser(request.user,w) and isprorower(request.user.rower) + # get video ID and offset if request.method == 'POST': form = VideoAnalysisCreateForm(request.POST)