from django.urls import path from ebooks.api.views import EbookListCreateAPIView, EbookDetailAPIVIew, ReviewCreateAPIView, ReviewDetailAPIView urlpatterns = [ # path('ebooks/', EbookListCreateAPIView.as_view(), name="ebook-list"), path('ebooks/', EbookListCreateAPIView.as_view(), name="ebook-list"), path('ebooks/<int:pk>', EbookDetailAPIVIew.as_view(), name="ebook-detail"), path('ebooks/<int:ebook_pk>/review/', ReviewCreateAPIView.as_view(), name="ebook-review"), path('review/<int:pk>', ReviewDetailAPIView.as_view(), name="review-detail"), ]
from django.urls import path from ebooks.api.views import (EbookListCreateAPIView, EbookDetailAPIView, ReviewCreateAPIView, ReviewDetailAPIView) # from ebooks.api.views import EbookAPIView urlpatterns = [ path('ebooks/', EbookListCreateAPIView.as_view(), name='ebook-list'), path('ebooks/<int:pk>/', EbookDetailAPIView.as_view(), name='ebook-detail'), # `ebook_pk` is from perform_create method on CreateAPIView: path('ebooks/<int:ebook_pk>/review/', ReviewCreateAPIView.as_view(), name='ebook-review'), path('reviews/<int:pk>', ReviewDetailAPIView.as_view(), name='review-detail'), ]
from django.urls import path, re_path from ebooks.api.views import EbookListCreateAPIView, EbookRetrieveUpdateDestroyAPIView, ReviewCreateAPIView, ReviewRetrieveUpdateDestroyAPIView app_name = 'ebooks' urlpatterns = [ path('ebooks', EbookListCreateAPIView.as_view(), name="list_create"), path('ebooks/<int:pk>', EbookRetrieveUpdateDestroyAPIView.as_view(), name="retrieve_update_destroy"), path('ebooks/<int:id>/reviews', ReviewCreateAPIView.as_view(), name="review_create"), path('ebooks/reviews/<int:pk>', ReviewRetrieveUpdateDestroyAPIView.as_view(), name="review_retrieve_update_destroy"), ]