diff --git a/src/core/models/users.py b/src/core/models/users.py index 1fdc66f97b1e17d6cbf48a815b5b1e84159d32de..178bab1977939c4b95f34854a8f9f73989d71b87 100644 --- a/src/core/models/users.py +++ b/src/core/models/users.py @@ -2,7 +2,7 @@ import logging import re from pathlib import Path from typing import TYPE_CHECKING, Any -from uuid import UUID, uuid4 +from uuid import uuid4 from timezone_field import TimeZoneField @@ -364,20 +364,14 @@ class PlatformUser(AbstractUser): assert isinstance(data, dict), 'Data must be a dictionary.' if not existing: raise NotImplementedError('Creating a PlatformUser with .from_dict() is not supported.') - if existing.user_type != PlatformUser.Type.SPEAKER: - raise NotImplementedError('Updating a PlatformUser which is not a SPEAKER is not supported (yet).') - given_uuid = UUID(data.pop('guid')) if 'guid' in data else None - if existing: - obj = existing - else: - obj = cls() - if given_uuid is not None: - obj.pk = given_uuid + obj = existing # join the new user into the conference - cm, _ = conference.users.get_or_create(user=obj) - cm.description = data.get('biography', '') + cm, created = conference.users.get_or_create(user=obj) + if existing.user_type == cls.Type.SPEAKER or created: + # only set the description/bio upon creation for real users (imported speakers are updated every time) + cm.description = data.get('biography', '') cm.save() # add all known addresses as (unverified and non-public) communication channels