from django.urls import path from rest_framework.routers import DefaultRouter from .views import CommentViewSet, MomentViewSet, ReactionViewSet router = DefaultRouter() router.register("", MomentViewSet, basename="moment") comments_list = CommentViewSet.as_view({"get": "list", "post": "create"}) comments_detail = CommentViewSet.as_view({"get": "retrieve", "delete": "destroy"}) reactions_list = ReactionViewSet.as_view({"get": "list", "post": "create"}) reactions_detail = ReactionViewSet.as_view({"get": "retrieve", "delete": "destroy"}) urlpatterns = [ path("/comments/", comments_list, name="moment-comments-list"), path("/comments//", comments_detail, name="moment-comments-detail"), path("/reactions/", reactions_list, name="moment-reactions-list"), path("/reactions//", reactions_detail, name="moment-reactions-detail"), ] + router.urls