diff --git a/doc/api/resources/orders.rst b/doc/api/resources/orders.rst index 9c5112f617..15b5775f77 100644 --- a/doc/api/resources/orders.rst +++ b/doc/api/resources/orders.rst @@ -128,6 +128,10 @@ last_modified datetime Last modificati The ``custom_followup_at`` attribute has been added. +.. versionchanged:: 4.4 + + The ``item`` and ``variation`` query parameters have been added. + .. _order-position-resource: @@ -415,6 +419,8 @@ List of all orders :query string code: Only return orders that match the given order code :query string status: Only return orders in the given order status (see above) :query string search: Only return orders matching a given search query + :query integer item: Only return orders with a position that contains this item ID. *Warning:* Result will also include orders if they contain mixed items, and it will even return orders where the item is only contained in a canceled position. + :query integer variation: Only return orders with a position that contains this variation ID. *Warning:* Result will also include orders if they contain mixed items and variations, and it will even return orders where the variation is only contained in a canceled position. :query boolean testmode: Only return orders with ``testmode`` set to ``true`` or ``false`` :query boolean require_approval: If set to ``true`` or ``false``, only categories with this value for the field ``require_approval`` will be returned. diff --git a/src/pretix/api/views/order.py b/src/pretix/api/views/order.py index ab0794805d..8ffa4684cc 100644 --- a/src/pretix/api/views/order.py +++ b/src/pretix/api/views/order.py @@ -92,6 +92,8 @@ with scopes_disabled(): subevent_after = django_filters.IsoDateTimeFilter(method='subevent_after_qs') subevent_before = django_filters.IsoDateTimeFilter(method='subevent_before_qs') 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') class Meta: model = Order