Badges: Add per-position downloads

This commit is contained in:
Raphael Michel
2018-12-19 12:31:44 +01:00
parent 215514fca7
commit eb85fa956e
4 changed files with 35 additions and 4 deletions

View File

@@ -217,8 +217,12 @@ class OrderPrintDo(EventPermissionRequiredMixin, AsyncAction, View):
cf.type = 'application/pdf'
cf.expires = now() + timedelta(days=3)
cf.save()
if 'position' in request.GET:
positions = [p.pk for p in order.positions.filter(pk=request.GET.get('position'))]
else:
positions = [p.pk for p in order.positions.all()]
return self.do(
str(cf.id),
self.request.event.pk,
[order.pk],
positions,
)