From c7e65ca9aa379f1cbb6a7ff523e8ccf385c9460b Mon Sep 17 00:00:00 2001 From: Konrad Mohrfeldt <konrad.mohrfeldt@farbdev.org> Date: Wed, 6 Sep 2023 14:42:20 +0200 Subject: [PATCH] feat(REST): add route-filter alternatives for timeslot endpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The nested timeslot routes allowed us to filter the timeslots by show and schedule. We’ve deprecated nested endpoints with the alpha.2 release, but still need the actual filtering logic. --- program/filters.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/program/filters.py b/program/filters.py index ca507c82..823ed52e 100644 --- a/program/filters.py +++ b/program/filters.py @@ -174,6 +174,16 @@ class TimeSlotFilterSet(filters.FilterSet): ), ) + scheduleIds = IntegerInFilter( + field_name="schedule", + help_text="Return only timeslots that belong to the specified schedule(s).", + ) + + showIds = IntegerInFilter( + field_name="schedule__show", + help_text="Return only timeslots that belong to the specified show(s).", + ) + def filter_surrounding(self, queryset: QuerySet, name: str, value: datetime.datetime): nearest_timeslots_in_future = ( models.TimeSlot.objects.filter(start__gte=value) -- GitLab