diff --git a/billard/views.py b/billard/views.py index 127f291..6382667 100644 --- a/billard/views.py +++ b/billard/views.py @@ -83,7 +83,7 @@ def accounting(request): 'location_id': int(loc), 'locations': locations, 'accounting': acc, - 'acc_ids': acc_ids, + 'acc_ids': ','.join(str(e) for e in acc_ids), } if acc_sum['prize__sum'] is None: context['acc_sum'] = 0 @@ -92,6 +92,9 @@ def accounting(request): return render(request, template_name=template, context=context) if request.method == 'POST': loc = request.POST['location-selector'] + if 'accountings' in request.POST: + acc_ids = request.POST['accountings'].split(',') + Accounting.objects.filter(id__in=acc_ids).update(billed=True) request.session['loc'] = str(loc) resp = redirect('accounting') resp['Location'] += '?loc={}'.format(str(loc))