From 3a2c21cbc23994a7877278301ce756352defd7f4 Mon Sep 17 00:00:00 2001 From: Alexander Werner Date: Thu, 2 Mar 2017 20:25:40 +0100 Subject: [PATCH] Added modal view --- billard/models.py | 3 ++- billard/templates/billard/index_ajax.html | 20 ++++++++++++++++++++ billard/views.py | 2 ++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/billard/models.py b/billard/models.py index b0f5d91..67511a6 100644 --- a/billard/models.py +++ b/billard/models.py @@ -53,6 +53,7 @@ class Location(models.Model): class Client(models.Model): uuid = models.UUIDField(unique=True, default=uuid.uuid4, verbose_name="Identifier") location = models.ForeignKey(Location, verbose_name="Standort") + report_user = models.ForeignKey(User, verbose_name="Reporting Benutzer", related_name='reporting_clients') def __str__(self): return '{}, {}'.format(self.location.name, self.uuid) @@ -172,4 +173,4 @@ def process_location_data(): ld.processed = True ld.error_msg = 'No existing accountings found. Stopp processing! {}, {}'.format(ld.client_id, ld.desk_no) ld.save() - log.error(ld.error_msg) + log.error(ld.error_msg) \ No newline at end of file diff --git a/billard/templates/billard/index_ajax.html b/billard/templates/billard/index_ajax.html index 10d7261..bd0d345 100644 --- a/billard/templates/billard/index_ajax.html +++ b/billard/templates/billard/index_ajax.html @@ -7,4 +7,24 @@
Keine Tische angelegt!
+{% endif %} +{% if accounts %} + {% endif %} \ No newline at end of file diff --git a/billard/views.py b/billard/views.py index 553ab9c..7775eb0 100644 --- a/billard/views.py +++ b/billard/views.py @@ -54,11 +54,13 @@ def index(request): loc = min_loc locations = Location.objects.filter(users__id=request.user.id).order_by('code') clients = Client.objects.filter(location_id=loc).order_by('id') + accounts = Accounting.objects.filter(reporter_uuid__in=Client.objects.filter(report_user=request.user)) context = { 'range': range(1, 9), 'locations': locations, 'clients': clients, 'location_id': int(loc), + 'accounts': accounts, } return render(request, template, context=context) if request.method == 'POST':