From ef2078d8d33d17098b113f8a755932e7482409f1 Mon Sep 17 00:00:00 2001 From: eric-intuitem <71850047+eric-intuitem@users.noreply.github.com> Date: Thu, 12 Dec 2024 01:15:00 +0100 Subject: [PATCH] fix requirement translation regression --- backend/core/serializers.py | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/backend/core/serializers.py b/backend/core/serializers.py index 0e3c95ae7..13bbcac5e 100644 --- a/backend/core/serializers.py +++ b/backend/core/serializers.py @@ -621,26 +621,29 @@ class Meta: class RequirementAssessmentReadSerializer(BaseModelSerializer): + class FilteredNodeSerializer(RequirementNodeReadSerializer): + class Meta: + model = RequirementNode + fields = [ + "id", + "urn", + "annotation", + "name", + "description", + "typical_evidence", + "ref_id", + "associated_reference_controls", + "associated_threats", + "parent_requirement", + ] + name = serializers.CharField(source="__str__") description = serializers.CharField(source="get_requirement_description") evidences = FieldsRelatedField(many=True) compliance_assessment = FieldsRelatedField() folder = FieldsRelatedField() assessable = serializers.BooleanField(source="requirement.assessable") - requirement = FieldsRelatedField( - [ - "id", - "urn", - "annotation", - "name", - "description", - "typical_evidence", - "ref_id", - "associated_reference_controls", - "associated_threats", - "parent_requirement", - ] - ) + requirement = FilteredNodeSerializer() class Meta: model = RequirementAssessment