diff --git a/src/core/models/schedules.py b/src/core/models/schedules.py index 85ff87e28236ce0e23633e3eb1bb42f49b1fb055..7eb8738f37459e3f836f16a9d2e41a61b9a3d900 100644 --- a/src/core/models/schedules.py +++ b/src/core/models/schedules.py @@ -174,6 +174,12 @@ class ScheduleSource(models.Model): 'last_name': name_split.pop(), 'first_name': ' '.join(name_split), } + + # set an existing UUID, if possible + if mail_guid: + user_kwargs['uuid'] = str(mail_guid) + + # create the PlatformUser new_user = PlatformUser(**user_kwargs) new_user.save() @@ -254,7 +260,7 @@ class ScheduleSource(models.Model): except ValueError: pass try: - candidate = item.get('guid') + candidate = item.get('uuid') or item.get('guid') if item_source_uuid is None and candidate and not isinstance(candidate, int): item_source_uuid = UUID(candidate) except ValueError: @@ -271,7 +277,7 @@ class ScheduleSource(models.Model): mapping, new_mapping = self.get_or_create_mapping( mapping_type=item_type, - source_id=item_source_id, + source_id=str(item_source_id), create_local_object=not item_delete, source_uuid=item_source_uuid, hints=hints,