From e99b6a51b8b6bd7146da9d16ec673e289867c957 Mon Sep 17 00:00:00 2001 From: Eugene Dyudyunov Date: Tue, 23 Aug 2022 14:58:24 +0300 Subject: [PATCH] fix: bundles list view Request-URI Too Long error There could be a lot of bundles, so we can't use query params because it will raise the "Request-URI Too Long" error. Use the request data in such case. --- blockstore/apps/rest_api/v1/views/bundles.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/blockstore/apps/rest_api/v1/views/bundles.py b/blockstore/apps/rest_api/v1/views/bundles.py index 46f6743..b02b84f 100644 --- a/blockstore/apps/rest_api/v1/views/bundles.py +++ b/blockstore/apps/rest_api/v1/views/bundles.py @@ -20,6 +20,13 @@ class BundleFilter(FilterSet): """ Filter for BundleViewSet. """ + def __init__(self, data=None, queryset=None, *, request=None, prefix=None): + # There could be a lot of bundles, so we can't use query params because it will + # raise the "Request-URI Too Long" error. Use the request data in such case. + # NOTE: query_params (data arg) have a higher priority than the request.data + data = data or request.data or {} + super().__init__(data, queryset, request=request, prefix=prefix) + uuid = AllValuesMultipleFilter(widget=CSVWidget) # Accepts multiple comma-separated UUIDs text_search = CharFilter(method='search')