From 224374f5e8c49c4c3c21cce43adaef89fb85ef8f Mon Sep 17 00:00:00 2001 From: klmp200 Date: Wed, 19 Oct 2016 01:57:54 +0200 Subject: [PATCH] More readable user_account --- core/templates/core/user_account.jinja | 12 ++++++------ core/views/user.py | 8 ++++---- counter/views.py | 1 - 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/core/templates/core/user_account.jinja b/core/templates/core/user_account.jinja index 1ecaa8d9..88c21d6d 100644 --- a/core/templates/core/user_account.jinja +++ b/core/templates/core/user_account.jinja @@ -12,13 +12,13 @@ {% for array in obj %} - {% for tuple in array %} - {% if tuple[0] != 0 %} - {% set link=url('core:user_account_detail', user_id=profile.id, year=tuple[1].year, month=tuple[1].month) %} + {% for dict in array %} + {% if dict['sum'] != 0 %} + {% set link=url('core:user_account_detail', user_id=profile.id, year=dict['date'].year, month=dict['date'].month) %} - {{ tuple[1].year }} - {{ tuple[1]|date("E") }} - {{ tuple[0] }} € + {{ dict['date'].year }} + {{ dict['date']|date("E") }} + {{ dict['sum'] }} € {% endif %} {% endfor %} diff --git a/core/views/user.py b/core/views/user.py index 0ed37567..92a7db9b 100644 --- a/core/views/user.py +++ b/core/views/user.py @@ -427,10 +427,10 @@ class UserAccountView(UserAccountBase): date__year=month.year, date__month=month.month ) - stats[i].append(( - sum([calc(p) for p in q]), - month - )) + stats[i].append({ + 'sum':sum([calc(p) for p in q]), + 'date':month + }) i += 1 return stats diff --git a/counter/views.py b/counter/views.py index da8c53a8..f450f0e8 100644 --- a/counter/views.py +++ b/counter/views.py @@ -1025,7 +1025,6 @@ class EticketPDFView(CanViewMixin, DetailView): self.object = self.get_object() eticket = self.object.product.eticket user = self.object.customer.user - print(self.object) code = "%s %s %s %s" % (self.object.customer.user.id, self.object.product.id, self.object.id, self.object.quantity) code += " " + eticket.get_hash(code)[:8].upper() response = HttpResponse(content_type='application/pdf')