diff --git a/backend/book_api/urls/v1.py b/backend/book_api/urls/v1.py index 3e2408c..e833f16 100644 --- a/backend/book_api/urls/v1.py +++ b/backend/book_api/urls/v1.py @@ -5,5 +5,5 @@ urlpatterns = [ path('', v1.BookView.as_view()), - path('/', v1.BookView.as_view()), + path('/', v1.BookView.as_view()), ] diff --git a/backend/book_api/views/v1.py b/backend/book_api/views/v1.py index 692a59d..de0162d 100644 --- a/backend/book_api/views/v1.py +++ b/backend/book_api/views/v1.py @@ -14,11 +14,11 @@ class BookView(APIView): permission_classes = [AllowAny] def get(self, request, *args, **kwargs): - pk = kwargs.get('pk', None) + book_code = kwargs.get('book_code', None) - if pk: + if book_code: try: - book = Book.objects.get(pk=pk, is_deleted=False) + book = Book.objects.get(book_code=book_code, is_deleted=False) except Book.DoesNotExist: raise NotFound(detail="Book not found.")