Fix bug in import save when non-existent member

This commit is contained in:
Yingtong Li 2019-01-29 15:35:15 +11:00
parent c8841f10b6
commit 168a8c17bc
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -121,7 +121,11 @@ def import_save(request):
member = mimport.by_email(request.POST['email_orig']) member = mimport.by_email(request.POST['email_orig'])
if member: if not member:
return render(request, 'ssmembership/import/review.html', {
'member': member
})
member.student_id = request.POST['student_id'] member.student_id = request.POST['student_id']
member.email = request.POST['email'] member.email = request.POST['email']
member.first_name = request.POST['first_name'] member.first_name = request.POST['first_name']
@ -131,7 +135,8 @@ def import_save(request):
member.is_msa = True if request.POST['is_msa'] == '1' else '0' member.is_msa = True if request.POST['is_msa'] == '1' else '0'
errors = member.validation_problems() errors = member.validation_problems()
if not member or len(errors) > 0:
if len(errors) > 0:
return render(request, 'ssmembership/import/review.html', { return render(request, 'ssmembership/import/review.html', {
'member': member, 'member': member,
'years': models.Member.YEARS, 'years': models.Member.YEARS,