Browse Source

fix: search list courses

master
mortezaei 1 year ago
parent
commit
5d806c8775
  1. 7
      apps/course/views/course.py

7
apps/course/views/course.py

@ -32,11 +32,16 @@ class CourseListAPIView(ListAPIView):
queryset = Course.objects.all().exclude(status=Course.StatusChoices.INACTIVE)
serializer_class = CourseListSerializer
filter_backends = [SearchFilter]
search_fields = ['title']
search_fields = ['title', 'category__name', 'professor__fullname']
@swagger_auto_schema(
operation_description=doc_course_list(),
manual_parameters=[
openapi.Parameter(
'search', openapi.IN_QUERY,
description="Search by course title, category name, or professor's full name",
type=openapi.TYPE_STRING,
),
openapi.Parameter(
'category_slug', openapi.IN_QUERY,
description="Category of the Course",

Loading…
Cancel
Save