API: Consistency with other subevent filters

This commit is contained in:
Raphael Michel
2022-07-14 09:21:56 +02:00
parent 8c63659050
commit 32ab7c3d4f
2 changed files with 6 additions and 6 deletions

View File

@@ -89,8 +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. Can be passed multiple times to filter :query integer subevent: Only return quotas of the sub-event with the given ID.
for multiple sub-events. :query integer subevent__in: Only return quotas of sub-events with one the given IDs (comma-separated).
: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, SubEvent, Question, QuestionOption, Quota,
) )
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,11 +459,11 @@ 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': ['exact', 'in'],
}
class QuotaViewSet(ConditionalListView, viewsets.ModelViewSet): class QuotaViewSet(ConditionalListView, viewsets.ModelViewSet):