diff --git a/program/views.py b/program/views.py index 48ecc8eaafda1a4a24470bca01751050e8ac61ee..069d9cc555c9e88919dff3bb70a48c715e9f7747 100644 --- a/program/views.py +++ b/program/views.py @@ -33,7 +33,7 @@ from rest_framework.pagination import LimitOffsetPagination from rest_framework.response import Response from django.contrib.auth.models import User -from django.http import Http404, HttpResponse +from django.http import Http404, HttpResponse, JsonResponse from django.shortcuts import get_object_or_404 from django.utils import timezone from django.utils.translation import gettext as _ @@ -501,6 +501,7 @@ class APIRRuleViewSet(viewsets.ModelViewSet): (`one-solution-per-conflict`). Only one solution is allowed per conflict, so you either offered too many or not enough solutions for any reported conflicts. + * The referenced recurrence rule does not exist. """ ), ), @@ -611,6 +612,13 @@ class APIScheduleViewSet( try: resolution = resolve_conflicts(request.data, pk, show_pk) + # FIXME: Find a better way to do this. + # The exception is thrown by the instantiate_upcoming_schedule function. + except RRule.DoesNotExist: + return JsonResponse( + {"rruleId": ["Ungültige rrule - Object existiert nicht."]}, + status=status.HTTP_400_BAD_REQUEST, + ) except ScheduleConflictError as exc: return Response(exc.conflicts, status.HTTP_409_CONFLICT)