Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. serializer_class = QuestionSerializer # set the serializer
  2. queryset = Question.objects.all() # set the query set to all the objects of that view
  3. filter_backends = (DjangoFilterBackend, OrderingFilter, SearchFilter) # allows for filters
  4. filter_fields = {'id': ['gte', 'lte', 'exact'], 'pub_date': ['gte', 'lte']}
  5. ordering_fields = ('id', 'question_text', 'pub_date')
  6. search_fields = 'question_text'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement