Private
Public Access
1
0

some error catching around has-teams and api permissions

This commit is contained in:
Sander Roosendaal
2017-04-07 08:24:10 +02:00
parent 70fdd5452e
commit 8658176cc9
2 changed files with 23 additions and 10 deletions

View File

@@ -173,10 +173,13 @@ def rdata(file,rower=rrower()):
# Query to get teams managed and member of
def get_my_teams(user):
therower = Rower.objects.get(user=user)
teams1 = therower.team.all()
teams2 = Team.objects.filter(manager=user)
teams = list(set(teams1).union(set(teams2)))
try:
therower = Rower.objects.get(user=user)
teams1 = therower.team.all()
teams2 = Team.objects.filter(manager=user)
teams = list(set(teams1).union(set(teams2)))
except TypeError:
teams = []
return teams