# Path: apps/tutorials/views/api.py
# class TutorialsViewSet(viewsets.ReadOnlyModelViewSet):
#     serializer_class = TutorialSerializer
#     queryset = Tutorial.objects.published()
#     lookup_field = "slug"
#     lookup_url_kwarg = "slug"
# 
#     def retrieve(self, request, *args, **kwargs):
#         instance = self.get_object()
#         serializer = TutorialDetailSerializer(instance)
#         return Response(serializer.data)


from rest_framework import routers
from apps.tutorials.views.api import TutorialsViewSet

router = routers.SimpleRouter()

app_name = "tutorials"

router.register(r"", TutorialsViewSet, basename="tutorials")


# Path: apps/tutorials/views/api.py
# class TutorialsViewSet(viewsets.ReadOnlyModelViewSet):
#     serializer_class = TutorialSerializer
#     queryset = Tutorial.objects.published()
#     lookup_field = "slug"
#     lookup_url_kwarg = "slug"
# 
#     def retrieve(self, request, *args, **kwargs):
#         instance = self.get_object()
#         serializer = TutorialDetailSerializer(instance)
#         return Response(serializer.data)


# Path: apps/tutorials/urls/api.py
from rest_framework import routers
from apps.tutorials.views.api import TutorialsViewSet


router = routers.SimpleRouter()

app_name = "tutorials"

router.register(r"", TutorialsViewSet, basename="tutorials")


urlpatterns = router.urls