Allow label printing api to print multiple copies of a label

This commit is contained in:
radex 2020-05-11 19:41:57 +02:00 committed by Piotr Dobrowolski
parent 35da79f0b2
commit 93ebd810aa
1 changed files with 3 additions and 1 deletions

View File

@ -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