Метод GET не разрешен [закрыто]
Я пытаюсь использовать второй url с методом get, и это дает мне ошибку Method "GET" not allowed
в 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),
])),
]
Ниже приведен мой взгляд
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()