From 93ebd810aa918aa1ece44ccfe3c51f19b06d6c8d Mon Sep 17 00:00:00 2001 From: radex Date: Mon, 11 May 2020 19:41:57 +0200 Subject: [PATCH] Allow label printing api to print multiple copies of a label --- storage/apiviews.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/storage/apiviews.py b/storage/apiviews.py index a043542..54ee944 100644 --- a/storage/apiviews.py +++ b/storage/apiviews.py @@ -32,8 +32,10 @@ class LabelViewSet(viewsets.ModelViewSet): @detail_route(methods=['post'], permission_classes=[AllowAny]) def print(self, request, pk): + quantity = min(int(request.query_params.get('quantity', 1)), 5) obj = self.get_object() - obj.print() + for _ in range(quantity): + obj.print() return obj