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 84598fbcd9c9..2283036faf24 100644 --- a/cms/djangoapps/contentstore/rest_api/v1/serializers/vertical_block.py +++ b/cms/djangoapps/contentstore/rest_api/v1/serializers/vertical_block.py @@ -180,3 +180,4 @@ class ContainerChildrenSerializer(serializers.Serializer): children = ContainerChildSerializer(many=True) is_published = serializers.BooleanField() can_paste_component = serializers.BooleanField() + display_name = serializers.CharField() diff --git a/cms/djangoapps/contentstore/rest_api/v1/views/course_index.py b/cms/djangoapps/contentstore/rest_api/v1/views/course_index.py index f79892658da0..7ab14028cd50 100644 --- a/cms/djangoapps/contentstore/rest_api/v1/views/course_index.py +++ b/cms/djangoapps/contentstore/rest_api/v1/views/course_index.py @@ -230,6 +230,7 @@ def get(self, request: Request, usage_key_string: str): ], "is_published": false, "can_paste_component": true, + "display_name": "Vertical block 1" } ``` """ @@ -277,6 +278,7 @@ def get(self, request: Request, usage_key_string: str): "children": children, "is_published": is_published, "can_paste_component": is_course, + "display_name": current_xblock.display_name_with_default, } serializer = ContainerChildrenSerializer(container_data) return Response(serializer.data) 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 16e6679833a2..5dea51b91d71 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 @@ -204,9 +204,11 @@ def test_success_response(self): url = self.get_reverse_url(self.vertical.location) response = self.client.get(url) self.assertEqual(response.status_code, status.HTTP_200_OK) - self.assertEqual(len(response.data["children"]), 2) - self.assertFalse(response.data["is_published"]) - self.assertTrue(response.data["can_paste_component"]) + data = response.json() + self.assertEqual(len(data["children"]), 2) + self.assertFalse(data["is_published"]) + self.assertTrue(data["can_paste_component"]) + self.assertEqual(data["display_name"], "Unit") def test_xblock_is_published(self): """