Method GET not allowed [closed]
I am trying to use the second url with the get method and it gives me the error Method "GET" not allowed
in Django app.
urlpatterns = [
path('book/', include([
path("<str:user_uuid>/<str:image_uuid>", BookView.as_view({"post": "post"}, http_method_names=["post"]), name=ApiName.BOOK_POST.value),
path("<str:user_uuid>/<str:book_uuid>", BookView.as_view({"get": "get"}, http_method_names=["get"]), name=ApiName.BOOK_GET.value),
path("edit/<str:user_uuid>/<str:book_uuid>", BookView.as_view({"post": "edit"}, http_method_names=["post"]), name=ApiName.BOOK_EDIT.value),
path("export/<str:user_uuid>/<str:book_uuid>", BookView.as_view({"post": "export"}, http_method_names=["post"]), name=ApiName.BOOK_EXPORT.value),
path("/images/<str:user_uuid>/<str:folder_uuid>", BookView.as_view({"post": "post_images"}, http_method_names=["post"]), name=ApiName.BOOK_IMAGES_POST.value),
path("<str:user_uuid>/<str:template_uuid>", BookView.as_view({"get": "get_template"}, http_method_names=["get"]), name=ApiName.BOOK_GET.value),
])),
]
Below is my view
class BookView(CustomViewSet):
parser_classes = [JSONParser, DrfNestedParser]
authentication_classes = [BaseApiAuthentication]
# permission_classes = [IsAuthenticated, FilePermission]
permission_classes = [IsAuthenticated]
@method_decorator(logging())
def post(self, request, user_uuid:str, image_uuid:str):
return api_response_success()
@method_decorator(logging())
def get(self, request, user_uuid:str, book_uuid:str):
return api_response_success()