From 018c3d70e386e4cd0a1b3fdd55767d48ddafaeb6 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Wed, 4 Jan 2023 18:29:35 +0100 Subject: [PATCH] API: Allow to set order of check-in lists --- doc/api/resources/checkinlists.rst | 2 ++ src/pretix/api/views/checkin.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/api/resources/checkinlists.rst b/doc/api/resources/checkinlists.rst index 9ff49e49ed..76ee5e99ca 100644 --- a/doc/api/resources/checkinlists.rst +++ b/doc/api/resources/checkinlists.rst @@ -98,6 +98,8 @@ Endpoints :query string ends_after: Exclude all check-in lists attached to a sub-event that is already in the past at the given time. :query string expand: Expand a field into a full object. Currently only ``subevent`` is supported. Can be passed multiple times. :query string exclude: Exclude a field from the output, e.g. ``checkin_count``. Can be used as a performance optimization. Can be passed multiple times. + :query string ordering: Manually set the ordering of results. Valid fields to be used are ``id``, ``name``, and ``subevent__date_from``, + Default: ``subevent__date_from,name`` :param organizer: The ``slug`` field of the organizer to fetch :param event: The ``slug`` field of the event to fetch :statuscode 200: no error diff --git a/src/pretix/api/views/checkin.py b/src/pretix/api/views/checkin.py index 0c7ed99deb..005f89ec34 100644 --- a/src/pretix/api/views/checkin.py +++ b/src/pretix/api/views/checkin.py @@ -93,8 +93,10 @@ with scopes_disabled(): class CheckinListViewSet(viewsets.ModelViewSet): serializer_class = CheckinListSerializer queryset = CheckinList.objects.none() - filter_backends = (DjangoFilterBackend,) + filter_backends = (DjangoFilterBackend, RichOrderingFilter) filterset_class = CheckinListFilter + ordering = ('subevent__date_from', 'name') + ordering_fields = ('subevent__date_from', 'id', 'name',) def _get_permission_name(self, request): if request.path.endswith('/failed_checkins/'):