Private
Public Access
1
0

list view improved

This commit is contained in:
Sander Roosendaal
2019-02-22 13:51:08 +01:00
parent e0c6e8d449
commit 0d1884962b
7 changed files with 86 additions and 31 deletions

View File

@@ -1024,6 +1024,25 @@ def checkworkoutuser(user,workout):
except Rower.DoesNotExist:
return False
# Check if workout may be viewed by this user
def checkworkoutuserview(user,workout):
if user.is_anonymous():
return False
try:
r = Rower.objects.get(user=user)
if workout.user == r:
return True
teams = workout.user.team.all()
for team in teams:
if team in r.team.all():
return True
return False
except Rower.DoesNotExist:
return False
return False
def checkviewworkouts(user,rower):
try:
r = user.rower