2020-04-05 04:40:03 +00:00
|
|
|
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
import django_tables2 as tables
|
|
|
|
from django.contrib.auth.models import User
|
2020-10-07 15:42:46 +00:00
|
|
|
from treasury.models import SogeCredit
|
|
|
|
|
2020-04-05 04:40:03 +00:00
|
|
|
|
|
|
|
class FutureUserTable(tables.Table):
|
2020-04-06 06:58:39 +00:00
|
|
|
"""
|
|
|
|
Display the list of pre-registered users
|
|
|
|
"""
|
2020-09-01 15:58:58 +00:00
|
|
|
phone_number = tables.Column(accessor='profile__phone_number')
|
2020-04-05 04:40:03 +00:00
|
|
|
|
2020-09-01 15:58:58 +00:00
|
|
|
section = tables.Column(accessor='profile__section')
|
2020-04-05 04:40:03 +00:00
|
|
|
|
|
|
|
class Meta:
|
|
|
|
attrs = {
|
|
|
|
'class': 'table table-condensed table-striped table-hover'
|
|
|
|
}
|
|
|
|
template_name = 'django_tables2/bootstrap4.html'
|
|
|
|
fields = ('last_name', 'first_name', 'username', 'email', )
|
|
|
|
model = User
|
|
|
|
row_attrs = {
|
2020-10-07 15:42:46 +00:00
|
|
|
'class': lambda record: 'table-row'
|
|
|
|
+ (' bg-warning' if SogeCredit.objects.filter(user=record).exists() else ''),
|
2020-04-05 04:40:03 +00:00
|
|
|
'data-href': lambda record: record.pk
|
|
|
|
}
|