Private
Public Access
1
0

passing tests - teams can be created

This commit is contained in:
Sander Roosendaal
2019-02-15 21:11:00 +01:00
parent 9bb7c3bef2
commit 948fbf76ee
7 changed files with 120 additions and 60 deletions

View File

@@ -928,6 +928,23 @@ def iscoachmember(user):
return result
def cancreateteam(user):
if user.is_anonymous():
return False
try:
r = Rower.objects.get(user=user)
except Rower.DoesNotExist:
r = Rower(user=user)
r.save()
if user.is_authenticated() and (r.rowerplan=='coach'):
return True
elif user.is_athenticated() and r.rowerplan in ['plan','pro']:
ts = Team.objects.filter(manager=user)
if len(otherteams) >= 1:
return False
# Check if a user can create planned sessions
def hasplannedsessions(user):
if not user.is_anonymous():