From f1d339d8bb0d6d9a51fc74dd3f4c3c9744d0f138 Mon Sep 17 00:00:00 2001 From: Konrad Mohrfeldt <konrad.mohrfeldt@farbdev.org> Date: Fri, 7 Apr 2023 02:12:40 +0200 Subject: [PATCH] feat: implement show and timeslot filters This is mainly so we can start phasing out nested routes. With nested routes objects were filtered based on route parameters. Therefore we need something similar in the form of query parameters. --- program/filters.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/program/filters.py b/program/filters.py index 73038ac7..298111c8 100644 --- a/program/filters.py +++ b/program/filters.py @@ -231,6 +231,14 @@ class TimeSlotFilterSet(filters.FilterSet): class NoteFilterSet(StaticFilterHelpTextMixin, filters.FilterSet): + show = IntegerInFilter( + field_name="timeslot__show", + help_text="Return only notes that belong to the specified show(s).", + ) + timeslot = IntegerInFilter( + field_name="timeslot", + help_text="Return only notes that belong to the specified timeslot(s).", + ) ids = IntegerInFilter( field_name="id", help_text="Return only notes matching the specified id(s).", @@ -245,7 +253,7 @@ class NoteFilterSet(StaticFilterHelpTextMixin, filters.FilterSet): help_texts = { "owner": "Return only notes created by the specified user.", } - fields = ["ids", "owner", "show_owner"] + fields = ["ids", "owner", "show", "timeslot", "show_owner"] class ActiveFilterSet(StaticFilterHelpTextMixin, filters.FilterSet): -- GitLab