From 59a502d6247bc9a176a61bf5db58c0d2ba56a540 Mon Sep 17 00:00:00 2001 From: Ehouarn Date: Sun, 3 Aug 2025 01:02:06 +0200 Subject: [PATCH] Added column deposit_type to MembershipsTable --- apps/permission/fixtures/initial.json | 21 ++++++++++++++++-- apps/wei/tables.py | 31 ++++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/apps/permission/fixtures/initial.json b/apps/permission/fixtures/initial.json index 6a60dbc9..248574e1 100644 --- a/apps/permission/fixtures/initial.json +++ b/apps/permission/fixtures/initial.json @@ -4401,6 +4401,22 @@ { "model": "permission.permission", "pk": 296, + "fields": { + "model": [ + "wei", + "weimembership" + ], + "query": "{\"club__weiclub__year\": [\"today\", \"year\"]}", + "type": "view", + "mask": 2, + "field": "", + "permanent": false, + "description": "Voir toutes les adhésions au WEI courant" + } + }, + { + "model": "permission.permission", + "pk": 297, "fields": { "model": [ "wei", @@ -4509,7 +4525,7 @@ 160, 212, 222, - 296 + 297 ] } }, @@ -4698,7 +4714,8 @@ 178, 183, 294, - 295 + 295, + 296 ] } }, diff --git a/apps/wei/tables.py b/apps/wei/tables.py index 7dc0d531..362bdf9c 100644 --- a/apps/wei/tables.py +++ b/apps/wei/tables.py @@ -187,6 +187,35 @@ class WEIMembershipTable(tables.Table): def render_year(self, record): return str(record.user.profile.ens_year) + "A" + def render_registration__deposit_type(self, record): + if record.registration.first_year: + return format_html("∅") + if record.registration.deposit_type == 'check': + # TODO Install Font Awesome 6 to acces more icons (and keep compaibility with current used v4) + return format_html(""" + + + + """) + if record.registration.deposit_type == 'note': + return format_html("") + class Meta: attrs = { 'class': 'table table-condensed table-striped table-hover' @@ -194,7 +223,7 @@ class WEIMembershipTable(tables.Table): model = WEIMembership template_name = 'django_tables2/bootstrap4.html' fields = ('user', 'user__last_name', 'user__first_name', 'registration__gender', 'user__profile__department', - 'year', 'bus', 'team', 'registration__deposit_given', ) + 'year', 'bus', 'team', 'registration__deposit_given', 'registration__deposit_type') row_attrs = { 'class': 'table-row', 'id': lambda record: "row-" + str(record.pk),