The documentation for the django filter is sparse. You can try to create a custom filter and specify the type of search. This is pretty confusing:
class BookFilter(django_filters.FilterSet): id = django_filters.NumberFilter(name="id", lookup_type="in") class Meta: model = Book fields = ['id']
And then change your view to use the filter class:
class BookView(viewsets.ReadOnlyModelViewSet): serializer_class = BookSerializer() model = Book filter_fields = ('id', 'name') filter_class = BookFilter
Then you can search for books through their identifiers (note "__in" is not used):
/v1/books/?id=1,2,3 /v1/books/?id=1
source share