From 7e50552dc0a73a378704c70566a01fd9b6fd7d13 Mon Sep 17 00:00:00 2001 From: Victor San Kho Lin Date: Wed, 21 Aug 2024 21:46:55 +1000 Subject: [PATCH] Fixed metadata endpoint allow dot sep in PK * This allows dot separator character primary key in API lookup. Such as 'BASE_URL/api/v1/library/lib.01J5TAAXYMXRRMA1VQNGW905AD' --- .../stateless/stacks/metadata-manager/app/viewsets/lab.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/workload/stateless/stacks/metadata-manager/app/viewsets/lab.py b/lib/workload/stateless/stacks/metadata-manager/app/viewsets/lab.py index f9dfd2ffa..089b9f630 100644 --- a/lib/workload/stateless/stacks/metadata-manager/app/viewsets/lab.py +++ b/lib/workload/stateless/stacks/metadata-manager/app/viewsets/lab.py @@ -11,6 +11,7 @@ class SubjectViewSet(ReadOnlyModelViewSet): + lookup_value_regex = "[^/]+" serializer_class = SubjectSerializer pagination_class = StandardResultsSetPagination filter_backends = [filters.OrderingFilter, filters.SearchFilter] @@ -68,6 +69,7 @@ def get_full_model_detail(self, request, pk=None): class SpecimenViewSet(ReadOnlyModelViewSet): + lookup_value_regex = "[^/]+" serializer_class = SpecimenSerializer pagination_class = StandardResultsSetPagination filter_backends = [filters.OrderingFilter, filters.SearchFilter] @@ -87,6 +89,7 @@ def get_queryset(self): class LibraryViewSet(ReadOnlyModelViewSet): + lookup_value_regex = "[^/]+" serializer_class = LibrarySerializer pagination_class = StandardResultsSetPagination filter_backends = [filters.OrderingFilter, filters.SearchFilter]