from rest_framework import viewsets
from rest_framework_extensions.mixins import DetailSerializerMixin

from catalog.serializers import (
    CourseSerializer,
    ShortCourseSerializer,
    CategorySerializer,
    ShortCategorySerializer
)
from catalog.models import Course, Category


class CourseViewSet(DetailSerializerMixin, viewsets.ReadOnlyModelViewSet):
    queryset = Course.objects.all()
    serializer_class = ShortCourseSerializer
    serializer_detail_class = CourseSerializer

    lookup_field = 'slug'


class CategoryViewSet(DetailSerializerMixin, viewsets.ReadOnlyModelViewSet):
    queryset = Category.objects.all()
    serializer_detail_class = CategorySerializer
    serializer_class = ShortCategorySerializer

@@ -377,36 +377,137 @@
  Course.objects.
-all(
+prefetch_related(%0A        %22document_set%22,%0A        %22document_set__user%22,%0A        %22document_set__tags%22%0A    
 )%0A    serializer

Make it fast