team manager can edit workout
This commit is contained in:
@@ -62,7 +62,7 @@
|
|||||||
<td> {{ workout.date |truncatechars:15}} </td>
|
<td> {{ workout.date |truncatechars:15}} </td>
|
||||||
<td> {{ workout.starttime }} </td>
|
<td> {{ workout.starttime }} </td>
|
||||||
<td>
|
<td>
|
||||||
{% if workout.user.user == user %}
|
{% if workout.user.user == user or user == team.manager %}
|
||||||
{% if workout.name != '' %}
|
{% if workout.name != '' %}
|
||||||
<a href="/rowers/workout/{{ workout.id }}/edit">{{ workout.name }}</a> </td>
|
<a href="/rowers/workout/{{ workout.id }}/edit">{{ workout.name }}</a> </td>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|||||||
@@ -302,7 +302,8 @@ def sendmail(request):
|
|||||||
def checkworkoutuser(user,workout):
|
def checkworkoutuser(user,workout):
|
||||||
try:
|
try:
|
||||||
r = Rower.objects.get(user=user)
|
r = Rower.objects.get(user=user)
|
||||||
return (workout.user == r)
|
managers = [team.manager for team in workout.team.all()]
|
||||||
|
return (workout.user == r or user in managers)
|
||||||
except Rower.DoesNotExist:
|
except Rower.DoesNotExist:
|
||||||
return(False)
|
return(False)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user