From 4d0cb78cb6513556cc9e12abdc1c262dec60589d Mon Sep 17 00:00:00 2001 From: Robert Einsle Date: Thu, 15 Feb 2018 15:58:55 +0100 Subject: [PATCH] add checkboxes for accounting --- billard/templates/billard/accounting.html | 39 ++++++++++++----------- billard/views.py | 6 ++-- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/billard/templates/billard/accounting.html b/billard/templates/billard/accounting.html index b8ca578..d8fb033 100644 --- a/billard/templates/billard/accounting.html +++ b/billard/templates/billard/accounting.html @@ -15,27 +15,30 @@ {{ pk }} - - - - - - - - - {% for acc in accounting %} - - - - - - - - {% endfor %} -
Start-Datum:Stop-Datum:Preis Normal:Preis Happy Hour:Preis gesamt:
{{ acc.time_from }}{{ acc.time_to }}{{ acc.prize_normal }}{{ acc.prize_hh }}{{ acc.prize }}
{% csrf_token %} + + + + + + + + + + {% for acc in accounting %} + + + + + + + + + {% endfor %} +
Start-Datum:Stop-Datum:Preis Normal:Preis Happy Hour:Preis gesamt:
{{ acc.time_from }}{{ acc.time_to }}{{ acc.prize_normal }}{{ acc.prize_hh }}{{ acc.prize }}
diff --git a/billard/views.py b/billard/views.py index 37fc297..f8a3fcb 100644 --- a/billard/views.py +++ b/billard/views.py @@ -1,16 +1,14 @@ -import ast import logging from django.contrib.auth.decorators import login_required, permission_required from django.db.models import Sum from django.http import HttpResponse from django.shortcuts import render, redirect +from django.urls import reverse_lazy from django.utils import timezone from django.utils.decorators import method_decorator from django.views import generic from django.views.generic import UpdateView -from django.urls import reverse_lazy - from rest_framework import viewsets from billard.models import LocationData, Location, Client, Accounting @@ -71,7 +69,7 @@ class AccountingView(generic.ListView): def accounting_confirm(request, pk): if request.method == 'POST': if 'accountings' in request.POST: - acc_ids = ast.literal_eval(request.POST['accountings']) + acc_ids = request.POST.getlist('list_acc_id') if len(acc_ids) > 0: Accounting.objects.filter(id__in=acc_ids).update( billed=True,