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,17 +121,22 @@ def import_save(request):
member = mimport.by_email(request.POST['email_orig'])
if member:
member.student_id = request.POST['student_id']
member.email = request.POST['email']
member.first_name = request.POST['first_name']
member.last_name = request.POST['last_name']
member.phone = request.POST['phone']
member.year = int(request.POST['year'])
member.is_msa = True if request.POST['is_msa'] == '1' else '0'
if not member:
return render(request, 'ssmembership/import/review.html', {
'member': member
})
errors = member.validation_problems()
if not member or len(errors) > 0:
member.student_id = request.POST['student_id']
member.email = request.POST['email']
member.first_name = request.POST['first_name']
member.last_name = request.POST['last_name']
member.phone = request.POST['phone']
member.year = int(request.POST['year'])
member.is_msa = True if request.POST['is_msa'] == '1' else '0'
errors = member.validation_problems()
if len(errors) > 0:
return render(request, 'ssmembership/import/review.html', {
'member': member,
'years': models.Member.YEARS,