API: Allow to filter quota list for multiple subevents

This commit is contained in:
Raphael Michel
2022-07-13 16:29:30 +02:00
parent 23e5af13ad
commit 8c63659050
2 changed files with 5 additions and 2 deletions

View File

@@ -89,7 +89,8 @@ Endpoints
:query integer page: The page number in case of a multi-page result set, default is 1 :query integer page: The page number in case of a multi-page result set, default is 1
:query string ordering: Manually set the ordering of results. Valid fields to be used are ``id`` and ``position``. :query string ordering: Manually set the ordering of results. Valid fields to be used are ``id`` and ``position``.
Default: ``position`` Default: ``position``
:query integer subevent: Only return quotas of the sub-event with the given ID :query integer subevent: Only return quotas of the sub-event with the given ID. Can be passed multiple times to filter
for multiple sub-events.
:query string with_availability: Set to ``true`` to get availability information. Can lead to increased answer times. :query string with_availability: Set to ``true`` to get availability information. Can lead to increased answer times.
:param organizer: The ``slug`` field of the organizer to fetch :param organizer: The ``slug`` field of the organizer to fetch
:param event: The ``slug`` field of the event to fetch :param event: The ``slug`` field of the event to fetch

View File

@@ -52,7 +52,7 @@ from pretix.api.serializers.item import (
from pretix.api.views import ConditionalListView from pretix.api.views import ConditionalListView
from pretix.base.models import ( from pretix.base.models import (
CartPosition, Item, ItemAddOn, ItemBundle, ItemCategory, ItemVariation, CartPosition, Item, ItemAddOn, ItemBundle, ItemCategory, ItemVariation,
Question, QuestionOption, Quota, Question, QuestionOption, Quota, SubEvent,
) )
from pretix.base.services.quotas import QuotaAvailability from pretix.base.services.quotas import QuotaAvailability
from pretix.helpers.dicts import merge_dicts from pretix.helpers.dicts import merge_dicts
@@ -459,6 +459,8 @@ class QuestionOptionViewSet(viewsets.ModelViewSet):
with scopes_disabled(): with scopes_disabled():
class QuotaFilter(FilterSet): class QuotaFilter(FilterSet):
subevent = django_filters.ModelMultipleChoiceFilter(queryset=SubEvent.objects.all())
class Meta: class Meta:
model = Quota model = Quota
fields = ['subevent'] fields = ['subevent']