Fix not allowing program times on event series (API/copy) (#5595)

* Fix not allowing program times on event series (API/copy)

* Return 400 when reading endpoint in event series

* add docs program times not available on event series

* fix isort
This commit is contained in:
Richard Schreiber
2025-11-17 15:36:53 +01:00
committed by GitHub
parent e2d9cbb41d
commit d7b6856322
6 changed files with 20 additions and 5 deletions

View File

@@ -40,7 +40,7 @@ from django_filters.rest_framework import DjangoFilterBackend, FilterSet
from django_scopes import scopes_disabled
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import PermissionDenied
from rest_framework.exceptions import PermissionDenied, ValidationError
from rest_framework.response import Response
from pretix.api.pagination import TotalOrderingFilter
@@ -293,6 +293,8 @@ class ItemProgramTimeViewSet(viewsets.ModelViewSet):
return get_object_or_404(Item, pk=self.kwargs['item'], event=self.request.event)
def get_queryset(self):
if self.request.event.has_subevents:
raise ValidationError('You cannot use program times on an event series.')
return self.item.program_times.all()
def get_serializer_context(self):