Private
Public Access
1
0

easy changing to athlete's workouts list for coaches

This commit is contained in:
Sander Roosendaal
2018-01-24 14:55:18 +01:00
parent 865d7837f9
commit 3e0b98fab8
4 changed files with 59 additions and 7 deletions

View File

@@ -623,6 +623,22 @@ def checkworkoutuser(user,workout):
except Rower.DoesNotExist:
return False
# Check if user is coach or rower
def checkaccessuser(user,rower):
try:
r = Rower.objects.get(user=user)
teams = Team.objects.filter(manager=user)
if rower == r:
return True
elif teams:
for team in teams:
if team in rower.team.all():
return True
else:
return False
except Rower.DoesNotExist:
return False
timezones = (
(x,x) for x in pytz.common_timezones
)