Skip to content

Commit

Permalink
add OrderingFilter in filter_backends
Browse files Browse the repository at this point in the history
  • Loading branch information
yunho7687 authored and thnorton committed Feb 12, 2025
1 parent fef862d commit ada2a37
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server/api/question/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class QuestionViewSet(viewsets.ModelViewSet):
"""
queryset = Question.objects.all().order_by("-time_created")
serializer_class = QuestionSerializer
filter_backends = [DjangoFilterBackend, filters.SearchFilter]
filter_backends = [DjangoFilterBackend, filters.SearchFilter, filters.OrderingFilter]
search_fields = ['name']
filterset_fields = ['mark', 'answers__value']
ordering_fields = ['time_created', 'time_modified', 'diff_level', 'mark']
Expand Down

0 comments on commit ada2a37

Please sign in to comment.