From 8038f4e173219adf1c66271ece3a440bd6e28576 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Mon, 6 Dec 2021 12:50:33 +0100 Subject: [PATCH] Orders API: Allow to filter by subevent --- doc/api/resources/orders.rst | 5 +++++ src/pretix/api/views/order.py | 1 + 2 files changed, 6 insertions(+) diff --git a/doc/api/resources/orders.rst b/doc/api/resources/orders.rst index 15b5775f77..3cfdb92b8a 100644 --- a/doc/api/resources/orders.rst +++ b/doc/api/resources/orders.rst @@ -132,6 +132,10 @@ last_modified datetime Last modificati The ``item`` and ``variation`` query parameters have been added. +.. versionchanged:: 4.6 + + The ``subevent`` query parameters has been added. + .. _order-position-resource: @@ -433,6 +437,7 @@ List of all orders recommend using this in combination with ``testmode=false``, since test mode orders can vanish at any time and you will not notice it using this method. :query datetime created_since: Only return orders that have been created since the given date. + :query integer subevent: Only return orders with a position that contains this subevent ID. *Warning:* Result will also include orders if they contain mixed subevents, and it will even return orders where the subevent is only contained in a canceled position. :query datetime subevent_after: Only return orders that contain a ticket for a subevent taking place after the given date. This is an exclusive after, and it considers the **end** of the subevent (or its start, if the end is not set). :query datetime subevent_before: Only return orders that contain a ticket for a subevent taking place after the given date. This is an exclusive before, and it considers the **start** of the subevent. :query string exclude: Exclude a field from the output, e.g. ``fees`` or ``positions.downloads``. Can be used as a performance optimization. Can be passed multiple times. diff --git a/src/pretix/api/views/order.py b/src/pretix/api/views/order.py index f27a510bce..241a7c9be7 100644 --- a/src/pretix/api/views/order.py +++ b/src/pretix/api/views/order.py @@ -94,6 +94,7 @@ with scopes_disabled(): search = django_filters.CharFilter(method='search_qs') item = django_filters.CharFilter(field_name='all_positions', lookup_expr='item_id') variation = django_filters.CharFilter(field_name='all_positions', lookup_expr='variation_id') + subevent = django_filters.CharFilter(field_name='all_positions', lookup_expr='subevent_id') class Meta: model = Order