nk20/apps/wei/tables.py

26 lines
732 B
Python
Raw Normal View History

2020-04-11 21:02:12 +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.urls import reverse_lazy
2020-04-12 00:30:48 +00:00
from .models import WEIClub
2020-04-11 21:02:12 +00:00
class WEITable(tables.Table):
"""
List all clubs.
"""
class Meta:
attrs = {
'class': 'table table-condensed table-striped table-hover'
}
model = WEIClub
template_name = 'django_tables2/bootstrap4.html'
fields = ('name', 'year', 'date_start', 'date_end',)
row_attrs = {
'class': 'table-row',
'id': lambda record: "row-" + str(record.pk),
2020-04-11 22:06:20 +00:00
'data-href': lambda record: reverse_lazy('wei:wei_detail', args=(record.pk,))
2020-04-11 21:02:12 +00:00
}