old_contents: from rest_framework import generics
  
  from .models import Category
  from .serializers import CategorySerializer
  
  
  class CategoryList(generics.ListAPIView):
      queryset = Category.objects.all()
      serializer_class = CategorySerializer
  
new_contents: from rest_framework import generics
  
  from .models import Category
  from .serializers import CategorySerializer
  
  
  class CategoryList(generics.ListAPIView):
      queryset = Category.objects.all()
      serializer_class = CategorySerializer
  
  
  class CategoryDetail(generics.RetrieveAPIView):
      queryset = Category.objects.all()
      serializer_class = CategorySerializer
  
      lookup_field = 'slug'
  
subject: add category detail view