nk20/apps/treasury/tables.py

33 lines
1.2 KiB
Python
Raw Normal View History

2020-03-20 23:30:49 +00:00
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
2020-03-21 16:02:28 +00:00
from django.utils.translation import gettext_lazy as _
2020-03-21 06:36:07 +00:00
import django_tables2 as tables
from django_tables2 import A
2020-03-20 23:30:49 +00:00
from .models import Billing
class BillingTable(tables.Table):
2020-03-21 16:02:28 +00:00
id = tables.LinkColumn("treasury:billing_update",
args=[A("pk")],
text=lambda record: _("Billing #{:d}").format(record.id),)
2020-03-21 06:36:07 +00:00
2020-03-21 16:02:28 +00:00
billing = tables.LinkColumn("treasury:billing_render",
verbose_name=_("Billing"),
2020-03-21 06:36:07 +00:00
args=[A("pk")],
accessor="pk",
text="",
2020-03-21 15:49:18 +00:00
attrs={
'a': {'class': 'fa fa-file-pdf-o'},
'td': {'data-turbolinks': 'false'}
})
2020-03-21 06:36:07 +00:00
2020-03-20 23:30:49 +00:00
class Meta:
attrs = {
'class': 'table table-condensed table-striped table-hover'
}
model = Billing
template_name = 'django_tables2/bootstrap4.html'
2020-03-21 16:02:28 +00:00
fields = ('id', 'name', 'subject', 'acquitted', 'billing', )