Created
July 7, 2019 19:32
-
-
Save akshar-raaj/d958be280664149d0f22ed5d7d0c4200 to your computer and use it in GitHub Desktop.
APIView with filter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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