diff --git a/djangoldp/serializers.py b/djangoldp/serializers.py index edd6600a83a2261d99580946d877d303efc91a40..1dc351541223e13530daa5fc104aff025c5eead1 100644 --- a/djangoldp/serializers.py +++ b/djangoldp/serializers.py @@ -12,7 +12,7 @@ from rest_framework.utils.serializer_helpers import ReturnDict class LDListMixin: def to_internal_value(self, data): - data = json.loads(data) + # data = json.loads(data) if isinstance(data, dict): data = [data] return [self.child_relation.to_internal_value(item['@id']) for item in data] @@ -34,7 +34,9 @@ class ContainerSerializer(LDListMixin, ListSerializer): @property def data(self): return ReturnDict(super(ListSerializer, self).data, serializer=self) - + + def create(self, validated_data): + return super().create(validated_data) class ManyJsonLdRelatedField(LDListMixin, ManyRelatedField): @@ -117,7 +119,8 @@ class LDPSerializer(HyperlinkedModelSerializer): except AttributeError: fields = '__all__' - return NestedLDPSerializer, get_nested_relation_kwargs(relation_info) + return NestedLDPSerializer, {"many": True} + @classmethod def many_init(cls, *args, **kwargs): diff --git a/djangoldp/tests/tests.py b/djangoldp/tests/tests.py index 899890c8b881a1538e0794ffb1a669723e79fa64..a92175489d289c45b472aa8a9130c6b7bc316682 100644 --- a/djangoldp/tests/tests.py +++ b/djangoldp/tests/tests.py @@ -12,8 +12,8 @@ class Serializer(TestCase): job = {"title": "job test", "skills": { "ldp:contains": [ - {"@id:": "https://happy-dev.fr/skills/{}/".format(skill1.pk)}, - {"@id:": "https://happy-dev.fr/skills/{}/".format(skill2.pk)}, + {"@id": "https://happy-dev.fr/skills/{}/".format(skill1.pk)}, + {"@id": "https://happy-dev.fr/skills/{}/".format(skill2.pk)}, ]} }