diff --git a/apps/tag/web/api/v1/api.py b/apps/tag/web/api/v1/api.py index 3b2f461..9229f94 100644 --- a/apps/tag/web/api/v1/api.py +++ b/apps/tag/web/api/v1/api.py @@ -613,6 +613,26 @@ class TagDistributionBatchViewSet( serializer = self.serializer_class(distribution_batch) return Response(serializer.data, status=status.HTTP_200_OK) + @action( + methods=['get'], + detail=True, + url_path='child_list', + url_name='child_list', + name='child_list' + ) + def child_list(self, request, pk=None): + """ + list of all child from a tag distribution batch + """ + dist_batch = self.get_object() + queryset = dist_batch.children.all() + + page = self.paginate_queryset(queryset) + if page is not None: # noqa + serializer = self.get_serializer(page, many=True) + return self.get_paginated_response(serializer.data) + return Response(self.serializer_class(queryset).data) + @action( methods=['post'], detail=True,