From 5d3cfe62108000826c86ddf90a7b00f5a7284d89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Mon, 29 Jul 2019 21:16:48 +0200 Subject: [PATCH] Order tickets in account page. --- src/profiles/templates/tickets/ticket_list.html | 6 +++++- src/tickets/views.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/profiles/templates/tickets/ticket_list.html b/src/profiles/templates/tickets/ticket_list.html index c00a9a79..ee63ccd8 100644 --- a/src/profiles/templates/tickets/ticket_list.html +++ b/src/profiles/templates/tickets/ticket_list.html @@ -23,9 +23,13 @@ Checked in Actions - {% for ticket in tickets %} + {% ifchanged ticket.ticket_type.camp %} + + + {{ ticket.ticket_type.camp }} + {% endifchanged %} {% if ticket.name %} diff --git a/src/tickets/views.py b/src/tickets/views.py index 7641664d..5a41f47b 100644 --- a/src/tickets/views.py +++ b/src/tickets/views.py @@ -19,7 +19,7 @@ class ShopTicketListView(LoginRequiredMixin, ListView): def get_queryset(self): tickets = super(ShopTicketListView, self).get_queryset() user = self.request.user - return tickets.filter(order__user=user) + return tickets.filter(order__user=user).order_by("ticket_type__camp") class ShopTicketDownloadView(LoginRequiredMixin, SingleObjectMixin, View):