From 8331b410cc2e5228c806e2c598bd8de30dd6e1ac Mon Sep 17 00:00:00 2001 From: ruzniaievdm Date: Tue, 9 Jan 2024 19:44:43 +0200 Subject: [PATCH] fix: [AXIMST-26] added block_type inside unit's children (#2490) --- .../rest_api/v1/serializers/vertical_block.py | 1 + .../rest_api/v1/views/tests/test_vertical_block.py | 2 ++ .../contentstore/rest_api/v1/views/vertical_block.py | 11 +++++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cms/djangoapps/contentstore/rest_api/v1/serializers/vertical_block.py b/cms/djangoapps/contentstore/rest_api/v1/serializers/vertical_block.py index 375643a6e852..0fe983beb660 100644 --- a/cms/djangoapps/contentstore/rest_api/v1/serializers/vertical_block.py +++ b/cms/djangoapps/contentstore/rest_api/v1/serializers/vertical_block.py @@ -99,6 +99,7 @@ class ChildVerticalContainerSerializer(serializers.Serializer): name = serializers.CharField(source="display_name_with_default") block_id = serializers.CharField(source="location") + block_type = serializers.CharField(source="location.block_type") class VerticalContainerSerializer(serializers.Serializer): diff --git a/cms/djangoapps/contentstore/rest_api/v1/views/tests/test_vertical_block.py b/cms/djangoapps/contentstore/rest_api/v1/views/tests/test_vertical_block.py index 23a318c5f5ff..848c579f093e 100644 --- a/cms/djangoapps/contentstore/rest_api/v1/views/tests/test_vertical_block.py +++ b/cms/djangoapps/contentstore/rest_api/v1/views/tests/test_vertical_block.py @@ -158,10 +158,12 @@ def test_children_content(self): { "name": self.html_unit_first.display_name_with_default, "block_id": str(self.html_unit_first.location), + "block_type": self.html_unit_first.location.block_type, }, { "name": self.html_unit_second.display_name_with_default, "block_id": str(self.html_unit_second.location), + "block_type": self.html_unit_second.location.block_type, }, ] self.assertEqual(response.data["children"], expected_response) diff --git a/cms/djangoapps/contentstore/rest_api/v1/views/vertical_block.py b/cms/djangoapps/contentstore/rest_api/v1/views/vertical_block.py index 43214726cd7e..d2d832e9674b 100644 --- a/cms/djangoapps/contentstore/rest_api/v1/views/vertical_block.py +++ b/cms/djangoapps/contentstore/rest_api/v1/views/vertical_block.py @@ -179,16 +179,19 @@ def get(self, request: Request, usage_key_string: str): "children": [ { "name": "Drag and Drop", - "block_id": "block-v1:org+101+101+type@drag-and-drop-v2+block@7599275ace6b46f5a482078a2954ca16" + "block_id": "block-v1:org+101+101+type@drag-and-drop-v2+block@7599275ace6b46f5a482078a2954ca16", + "block_type": "drag-and-drop-v2" }, { "name": "Video", - "block_id": "block-v1:org+101+101+type@video+block@0e3d39b12d7c4345981bda6b3511a9bf" + "block_id": "block-v1:org+101+101+type@video+block@0e3d39b12d7c4345981bda6b3511a9bf", + "block_type": "video" }, { "name": "Text", - "block_id": "block-v1:org+101+101+type@html+block@3e3fa1f88adb4a108cd14e9002143690" - } + "block_id": "block-v1:org+101+101+type@html+block@3e3fa1f88adb4a108cd14e9002143690", + "block_type": "html" + }, ], "is_published": false }