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

fix: fix invalid query types for program endpoints

drf-spectacular is smart and checks the type of the value attribute for
filters with a method override.

If we don’t provide a type hint it uses the default type hint it derives
for the field, which is what we want in this case.
parent 0cd4e85e
No related branches found
No related tags found
No related merge requests found
......@@ -348,7 +348,8 @@ class VirtualTimeslotFilterSet(filters.FilterSet):
# Filters using the noop are implemented in the generate_program_entries generator.
# We do this, so that we have all the bells and whistles of the automatic value conversion,
# but can still implement custom filter logic on top.
def filter_noop(self, queryset: QuerySet, _: str, value: bool) -> QuerySet:
# NOTE: DO NOT add a typehint for value, because this will be picked up by drf-spectacular.
def filter_noop(self, queryset: QuerySet, _: str, value) -> QuerySet:
return queryset
def filter_queryset(self, queryset: QuerySet):
......
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