X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/1b9cdd6220596c93a73c180249a10e6d6f9bd3e4..a53641cd866435bd94d4fcffe0cd0a9e0ac28d99:/src/catalogue/api/views.py?ds=sidebyside diff --git a/src/catalogue/api/views.py b/src/catalogue/api/views.py index 3449339e5..a04cc6d61 100644 --- a/src/catalogue/api/views.py +++ b/src/catalogue/api/views.py @@ -180,8 +180,7 @@ class BookList(LegacyListAPIView): bm.index = index bm.project_description = project_description bm.project_icon = project_icon - bm.file.save(None, request.data['file'], save=False) - bm.save(parts_count=parts_count) + bm.set_file(request.data['file'], parts_count=parts_count) return Response({}, status=status.HTTP_201_CREATED) @@ -584,5 +583,5 @@ from rest_framework.views import APIView class BookJsonView(APIView): def get(self, request, slug): book = get_object_or_404(Book, slug=slug) - js = conv(etree.parse(book.xml_file.path)) + js = conv(etree.parse(book.xml_file.path), slug) return JsonResponse(js, json_dumps_params={'ensure_ascii': False})