Fix registration import, use user.person if it exists. Commit ready for merge

- Legacy-Id: 16359
This commit is contained in:
Ryan Cross 2019-07-02 17:24:41 +00:00
parent e101d94065
commit b41aef6e5a

View file

@ -1,3 +1,6 @@
# Copyright The IETF Trust 2009-2019, All Rights Reserved
# -*- coding: utf-8 -*-
import re
import requests
from collections import defaultdict
@ -289,15 +292,23 @@ def get_meeting_registration_data(meeting):
)
aliases = Alias.objects.filter(name=regname)
if aliases.exists():
person = aliases.first().person
else:
# Create the new Person object.
person = Person.objects.create(
name=regname,
ascii=ascii_name,
user=user,
)
try:
if user.person:
person = user.person
else:
person = None
except Person.DoesNotExist:
person = None
if person is None:
if aliases.exists():
person = aliases.first().person
else:
# Create the new Person object.
person = Person.objects.create(
name=regname,
ascii=ascii_name,
user=user,
)
# Create an associated Email address for this Person
try: