From 576f25def45cb9c60f35de229268752b1f44f0f0 Mon Sep 17 00:00:00 2001 From: Calum Mackervoy <c.mackervoy@gmail.com> Date: Fri, 31 Jul 2020 10:14:11 +0200 Subject: [PATCH] update: resolve_fk_instances behaviour changed by create param --- djangoldp/serializers.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/djangoldp/serializers.py b/djangoldp/serializers.py index f565863f..c17e021b 100644 --- a/djangoldp/serializers.py +++ b/djangoldp/serializers.py @@ -651,11 +651,11 @@ class LDPSerializer(HyperlinkedModelSerializer): kwargs = {slug_field: field_dict[slug_field]} sub_inst = field_model.objects.get(**kwargs) if sub_inst is None: - with transaction.atomic(): - try: - sub_inst = self.internal_create(field_dict, field_model) - except: - continue + if create: + sub_inst = self.internal_create(field_dict, field_model) + else: + continue + validated_data[field_name] = sub_inst return validated_data -- GitLab