Skip to content

Instantly share code, notes, and snippets.

@akshar-raaj
Created July 7, 2019 19:32
Show Gist options
  • Select an option

  • Save akshar-raaj/d958be280664149d0f22ed5d7d0c4200 to your computer and use it in GitHub Desktop.

Select an option

Save akshar-raaj/d958be280664149d0f22ed5d7d0c4200 to your computer and use it in GitHub Desktop.
APIView with filter
from rest_framework import filters
class QuestionsAPIView(generics.ListCreateAPIView):
search_fields = ['question_text']
filter_backends = (filters.SearchFilter,)
queryset = Question.objects.all()
serializer_class = QuestionSerializer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment