1
0
mirror of https://github.com/etesync/server synced 2024-11-18 14:58:09 +00:00

CollectionItem: add support for filtering collections' main items.

This used to be the default, so it still is.

It only affects the list endpoint, the rest all support withCollection
anyway, because IDs are passed directly.
This commit is contained in:
Tom Hacohen 2020-06-23 13:02:45 +03:00
parent 291ebaa3f7
commit 317c492688

View File

@ -254,6 +254,10 @@ class CollectionItemViewSet(BaseViewSet):
def list(self, request, collection_uid=None):
queryset = self.get_queryset()
if not self.request.query_params.get('withCollection', False):
queryset = queryset.filter(parent__isnull=True)
queryset, new_stoken, done = self.filter_by_stoken_and_limit(request, queryset)
serializer = self.get_serializer(queryset, many=True)