1 # This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
4 from rest_framework.generics import ListAPIView
5 from rest_framework.response import Response
6 from rest_framework.views import APIView
7 from search.views import get_hints
8 from search.forms import SearchFilters
11 class HintView(APIView):
12 def get(self, request):
13 term = request.query_params.get('q')
14 hints = get_hints(term, request.user)
15 return Response(hints)
18 class SearchView(APIView):
19 def get(self, request):
20 term = self.request.query_params.get('q')
21 f = SearchFilters({'q': term})
27 class BookSearchView(ListAPIView):
28 def get_queryset(self, request):
29 term = self.request.query_params.get('q')
31 class TextSearchView(ListAPIView):
32 def get_queryset(self, request):
33 term = self.request.query_params.get('q')