From 0ae82767af8d1a0c85b20a1dcf2bfec2a3cb2d1c Mon Sep 17 00:00:00 2001 From: bruhnild Date: Wed, 28 Aug 2024 18:22:03 +0200 Subject: [PATCH] filter out deleted services in API response --- docs/changelog.rst | 2 +- geotrek/api/v2/views/trekking.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 2afa10410c..98f544b3f2 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -8,7 +8,7 @@ CHANGELOG **Minor fixes** - Fix swapped plural and singular translations for Annotation Categories (#4032) - +- Filter out deleted services in API responses (#4284) 2.109.1 (2024-08-22) ---------------------------- diff --git a/geotrek/api/v2/views/trekking.py b/geotrek/api/v2/views/trekking.py index 4aa345b1f5..4df21783e0 100644 --- a/geotrek/api/v2/views/trekking.py +++ b/geotrek/api/v2/views/trekking.py @@ -224,7 +224,7 @@ def retrieve(self, request, pk=None, format=None): class ServiceViewSet(api_viewsets.GeotrekGeometricViewset): filter_backends = api_viewsets.GeotrekGeometricViewset.filter_backends + (api_filters.NearbyContentFilter, api_filters.UpdateOrCreateDateFilter, api_filters.GeotrekServiceFilter) serializer_class = api_serializers.ServiceSerializer - queryset = trekking_models.Service.objects.all() \ + queryset = trekking_models.Service.objects.existing() \ .select_related('topo_object', 'type', ) \ .prefetch_related('topo_object__aggregations', Prefetch('attachments',