add search option
[redakcja.git] / src / documents / api / views.py
index a2f3529..751a9d4 100644 (file)
@@ -23,8 +23,11 @@ class BookDetail(RetrieveAPIView):
 class ChunkList(ListAPIView):
     queryset = models.Chunk.objects.all()
     serializer_class = serializers.ChunkSerializer
-    filter_fields = ['user', 'stage']
-    search_fields = ['book__title']
+    filterset_fields = ['user', 'stage']
+    search_fields = [
+        'book__title',
+        '=book_slug',
+    ]
 
     def get_queryset(self):
         return models.Chunk.get_visible_for(self.request.user)