1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-10-16 02:24:57 +02:00

Export club members

This commit is contained in:
Ehouarn
2025-09-28 21:15:01 +02:00
parent 83c8b9a3d0
commit 27a1f36183
5 changed files with 60 additions and 2 deletions

View File

@@ -92,6 +92,20 @@ class MembershipTable(tables.Table):
}
)
user_email = tables.Column(
verbose_name="Email",
accessor="user.email",
orderable=False,
visible=False,
)
user_full_name = tables.Column(
verbose_name=_("Full name"),
accessor="user.get_full_name",
orderable=False,
visible=False,
)
def render_user(self, value):
# If the user has the right, link the displayed user with the page of its detail.
s = value.username
@@ -149,6 +163,16 @@ class MembershipTable(tables.Table):
+ "'>" + s + "</a>")
return s
def value_user(self, record):
return record.user.username if record.user else ""
def value_club(self, record):
return record.club.name if record.club else ""
def value_roles(self, record):
roles = record.roles.all()
return ", ".join(str(role) for role in roles)
class Meta:
attrs = {
'class': 'table table-condensed table-striped',