def get_book_detail(request,book_id): "The parameter is still in string format instead of int" book = book_service.get_book_by_id(book_id) if not book: raise Http404("Book with id %s Not Found" % book_id) return JsonResponse(book.jsonable())
def update_book(request): bid = get_POST_param(request,'book_id',None) book = None if bid: book = book_service.get_book_by_id(bid) else: return HttpResponseServerError("id is None") if not book: raise Http404("Book with id %s Not Found" % bid) fill_in_book(request,book) book_service.update_book(book) return HttpResponse("{'status':'OK'}")