From f6d042c99897f85e0ed11158fe5138502e29b510 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sun, 12 Sep 2021 20:10:50 +0200 Subject: [PATCH] [WEI] Attribute bus to people that paid their registration Signed-off-by: Yohann D'ANELLO --- apps/wei/tables.py | 2 +- apps/wei/views.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/wei/tables.py b/apps/wei/tables.py index d3c4e14f..d9e095c9 100644 --- a/apps/wei/tables.py +++ b/apps/wei/tables.py @@ -193,7 +193,7 @@ class WEIRegistration1ATable(tables.Table): model = WEIMembership template_name = 'django_tables2/bootstrap4.html' fields = ('user', 'user__last_name', 'user__first_name', 'gender', - 'user__profile__department', 'preferred_bus', ) + 'user__profile__department', 'preferred_bus', 'membership__bus', ) row_attrs = { 'class': 'table-row', 'id': lambda record: "row-" + str(record.pk), diff --git a/apps/wei/views.py b/apps/wei/views.py index 2b3a752c..d0601c63 100644 --- a/apps/wei/views.py +++ b/apps/wei/views.py @@ -1174,7 +1174,8 @@ class WEI1AListView(LoginRequiredMixin, ProtectQuerysetMixin, SingleTableView): def get_queryset(self, filter_permissions=True, **kwargs): qs = super().get_queryset(filter_permissions, **kwargs) - qs = qs.filter(first_year=True) + qs = qs.filter(first_year=True, membership__isnull=False) + qs = qs.order_by('membership__bus') return qs def get_context_data(self, **kwargs):