Skip to content
Snippets Groups Projects
Commit a344ad5d authored by Konrad Mohrfeldt's avatar Konrad Mohrfeldt :koala:
Browse files

feat: add ids-filter to show, schedule and timeslot endpoints

This makes it easy to list entries with specific ids, which comes in
handy when clients want to fetch multiple known objects at once.
parent 3c82c6f6
No related branches found
No related tags found
1 merge request!53ids-filter for show, schedule, and timeslot endpoints
Pipeline #8337 passed
......@@ -57,6 +57,10 @@ class ShowOrderingFilter(filters.OrderingFilter):
class ShowFilterSet(StaticFilterHelpTextMixin, filters.FilterSet):
ids = IntegerInFilter(
field_name="id",
help_text="Return only shows matching the specified id(s).",
)
order = ShowOrderingFilter(
fields=["name", "slug", "id", "is_active", "is_owner", "updated_at", "updated_by"],
help_text="Order shows by the given field(s).",
......@@ -131,6 +135,7 @@ class ShowFilterSet(StaticFilterHelpTextMixin, filters.FilterSet):
class Meta:
model = models.Show
fields = [
"ids",
"order",
"category_ids",
"category_slug",
......@@ -150,6 +155,10 @@ class ShowFilterSet(StaticFilterHelpTextMixin, filters.FilterSet):
class ScheduleFilterSet(filters.FilterSet):
ids = IntegerInFilter(
field_name="id",
help_text="Return only schedules matching the specified id(s).",
)
show_ids = IntegerInFilter(
field_name="show",
help_text="Return only schedules that belong to the specified show(s).",
......@@ -171,6 +180,10 @@ class ScheduleFilterSet(filters.FilterSet):
class TimeSlotFilterSet(filters.FilterSet):
ids = IntegerInFilter(
field_name="id",
help_text="Return only timeslots matching the specified id(s).",
)
order = filters.OrderingFilter(
fields=[field.name for field in models.TimeSlot._meta.get_fields()]
)
......@@ -237,6 +250,7 @@ class TimeSlotFilterSet(filters.FilterSet):
class Meta:
model = models.TimeSlot
fields = [
"ids",
"order",
"start",
"end",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment