1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-21 09:58:23 +02:00

List pre-registrations (TODO: filter)

This commit is contained in:
Yohann D'ANELLO
2020-04-12 04:29:44 +02:00
parent 6b8e9d45fd
commit bdb0f677e5
4 changed files with 119 additions and 10 deletions

View File

@ -3,13 +3,15 @@
import django_tables2 as tables
from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _
from django_tables2 import A
from .models import WEIClub
from .models import WEIClub, WEIRegistration
class WEITable(tables.Table):
"""
List all clubs.
List all WEI.
"""
class Meta:
attrs = {
@ -23,3 +25,61 @@ class WEITable(tables.Table):
'id': lambda record: "row-" + str(record.pk),
'data-href': lambda record: reverse_lazy('wei:wei_detail', args=(record.pk,))
}
class WEIRegistrationTable(tables.Table):
"""
List all WEI registrations.
"""
user = tables.LinkColumn(
'member:user_detail',
args=[A('user.pk')],
)
edit = tables.LinkColumn(
'wei:wei_detail',
args=[A('pk')],
verbose_name=_("Edit"),
text=_("Edit"),
attrs={
'a': {
'class': 'btn btn-warning'
}
}
)
validate = tables.LinkColumn(
'wei:wei_detail',
args=[A('pk')],
verbose_name=_("Validate"),
text=_("Validate"),
attrs={
'a': {
'class': 'btn btn-success'
}
}
)
delete = tables.LinkColumn(
'wei:wei_detail',
args=[A('pk')],
verbose_name=_("delete"),
text=_("Delete"),
attrs={
'a': {
'class': 'btn btn-danger'
}
},
)
class Meta:
attrs = {
'class': 'table table-condensed table-striped table-hover'
}
model = WEIRegistration
template_name = 'django_tables2/bootstrap4.html'
fields = ('user',)
row_attrs = {
'class': 'table-row',
'id': lambda record: "row-" + str(record.pk),
'data-href': lambda record: record.pk
}