update accounting

This commit is contained in:
Robert Einsle 2017-03-11 20:48:59 +01:00
parent ab6d1fa07e
commit 522411ea34

View File

@ -83,7 +83,7 @@ def accounting(request):
'location_id': int(loc), 'location_id': int(loc),
'locations': locations, 'locations': locations,
'accounting': acc, 'accounting': acc,
'acc_ids': acc_ids, 'acc_ids': ','.join(str(e) for e in acc_ids),
} }
if acc_sum['prize__sum'] is None: if acc_sum['prize__sum'] is None:
context['acc_sum'] = 0 context['acc_sum'] = 0
@ -92,6 +92,9 @@ def accounting(request):
return render(request, template_name=template, context=context) return render(request, template_name=template, context=context)
if request.method == 'POST': if request.method == 'POST':
loc = request.POST['location-selector'] 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) request.session['loc'] = str(loc)
resp = redirect('accounting') resp = redirect('accounting')
resp['Location'] += '?loc={}'.format(str(loc)) resp['Location'] += '?loc={}'.format(str(loc))