Private
Public Access
1
0

Merge tag 'teamrequestfix2' into develop

bugfixes
This commit is contained in:
Sander Roosendaal
2017-02-10 16:29:07 +01:00
3 changed files with 15 additions and 5 deletions

View File

@@ -254,7 +254,7 @@ def handle_sendemail_invite(email,name,code,teamname,manager):
message += 'https://rowsandall.com/rowers/me/invitation/'+code+' \n\n'
message += 'You can also manually accept your team membership with the code.\n'
message += 'You will need to do this if you registered under a differnt email address than this one.\n'
message += 'You will need to do this if you registered under a different email address than this one.\n'
message += 'Code: '+code+'\n'
message += 'Link to manually accept your team membership: '
message += 'https://rowsandall.com/rowers/me/invitation\n\n'

View File

@@ -169,6 +169,12 @@ def create_invite(team,manager,user=None,email=''):
return (0,'Already member of that team')
elif email==None or email=='':
return (0,'Invalid request - missing email or user')
else:
try:
r2 = Rower.objects.get(user__email=email)
user = User.objects.get(rower=r2)
except Rower.DoesNotExist:
user=None
if count_club_members(team.manager)+count_invites(team.manager) < r.clubsize:
codes = [i.code for i in TeamInvite.objects.all()]
@@ -242,7 +248,11 @@ def reject_invitation(user,id):
def send_invite_email(id):
invitation = TeamInvite.objects.get(id=id)
try:
invitation = TeamInvite.objects.get(id=id)
except TeamInvite.DoesNotExist:
return (0,'Invitation doesn not exist')
if invitation.user:
email = invitation.user.email
name = invitation.user.first_name + " " + invitation.user.last_name

View File

@@ -5305,7 +5305,7 @@ def team_view(request,id=0,message='',successmessage=''):
if request.method == 'POST' and request.user == t.manager:
inviteform = TeamInviteForm(request.POST)
inviteform = TeamInviteForm(request.POST)
inviteform.fields['user'].queryset = User.objects.filter(rower__isnull=False,rower__team__in=myteams).distinct().exclude(rower__team__name=t.name)
if inviteform.is_valid():
cd = inviteform.cleaned_data
@@ -5321,7 +5321,7 @@ def team_view(request,id=0,message='',successmessage=''):
message = text
elif request.user == t.manager:
inviteform = TeamInviteForm()
inviteform = TeamInviteForm()
inviteform.fields['user'].queryset = User.objects.filter(rower__isnull=False,rower__team__in=myteams).distinct().exclude(rower__team__name=t.name)
else:
inviteform = ''
@@ -5529,7 +5529,7 @@ def rower_invitations_view(request,code=None,message='',successmessage=''):
'successmessage': successmessage,
})
else:
message = text
message = text
url = reverse(rower_teams_view,kwargs={
'message':message,
})