diff --git a/_modules/apis_core/relations/serializers.html b/_modules/apis_core/relations/serializers.html index f056b36f4..1840f8095 100644 --- a/_modules/apis_core/relations/serializers.html +++ b/_modules/apis_core/relations/serializers.html @@ -103,16 +103,22 @@

Source code for apis_core.relations.serializers

< [docs] @extend_schema_field(SimpleObjectSerializer()) def get_subj(self, obj): - serializer = serializer_factory(type(obj.subj), SimpleObjectSerializer) - return serializer(obj.subj, context={"request": self.context["request"]}).data
+ if obj.subj: + serializer = serializer_factory(type(obj.subj), SimpleObjectSerializer) + return serializer( + obj.subj, context={"request": self.context["request"]} + ).data
[docs] @extend_schema_field(SimpleObjectSerializer()) def get_obj(self, obj): - serializer = serializer_factory(type(obj.obj), SimpleObjectSerializer) - return serializer(obj.obj, context={"request": self.context["request"]}).data
+ if obj.obj: + serializer = serializer_factory(type(obj.obj), SimpleObjectSerializer) + return serializer( + obj.obj, context={"request": self.context["request"]} + ).data diff --git a/htmlcov/class_index.html b/htmlcov/class_index.html index f05a9cfea..7eb3b98db 100644 --- a/htmlcov/class_index.html +++ b/htmlcov/class_index.html @@ -55,7 +55,7 @@

coverage.py v7.6.8, - created at 2024-12-11 07:24 +0000 + created at 2024-12-11 07:36 +0000

@@ -2875,10 +2875,10 @@

apis_core/relations/serializers.py RelationSerializer - 4 - 4 + 6 + 6 0 - 0% + 0% apis_core/relations/serializers.py @@ -3517,10 +3517,10 @@

Total   - 4052 - 1979 + 4054 + 1981 0 - 51% + 51% @@ -3532,7 +3532,7 @@

coverage.py v7.6.8, - created at 2024-12-11 07:24 +0000 + created at 2024-12-11 07:36 +0000