From 4c7172be5dddd2e8dbd5ab8a47ce26a236066af2 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 24 Apr 2020 13:56:21 +0200 Subject: [PATCH] bug fixes --- rowers/plannedsessions.py | 3 ++- rowers/views/statements.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/rowers/plannedsessions.py b/rowers/plannedsessions.py index 978faa69..cb174375 100644 --- a/rowers/plannedsessions.py +++ b/rowers/plannedsessions.py @@ -1333,7 +1333,8 @@ def add_workout_indoorrace(ws,race,r,recordid=0): errors.append('For tests and training sessions, selected workouts must all be done on the same date') return result,comments,errors,0 - if ws.count()>1 and race.sessiontype == 'test': + + if len(ws)>1 and race.sessiontype == 'test': errors.append('For tests, you can only attach one workout') return result,comments,errors,0 diff --git a/rowers/views/statements.py b/rowers/views/statements.py index 01599ae1..98748756 100644 --- a/rowers/views/statements.py +++ b/rowers/views/statements.py @@ -1176,7 +1176,10 @@ def sendmail(request): subject = 'Rowsandall Contact Form:'+form.cleaned_data['subject'] message = form.cleaned_data['message'] fullemail = firstname + " " + lastname + " " + "<" + email + ">" - send_mail(subject, message, fullemail, ['info@rowsandall.com']) + try: + send_mail(subject, message, fullemail, ['info@rowsandall.com']) + except: + messages.error(request,"Something went wrong trying to send the email") return HttpResponseRedirect('/rowers/email/thankyou/') else: if not success: