mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-12-14 07:15:16 +01:00
Add interface to create and see note sheets
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
22
apps/sheets/tables.py
Normal file
22
apps/sheets/tables.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# Copyright (C) 2018-2022 by BDE ENS Paris-Saclay
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import django_tables2 as tables
|
||||
from django.urls import reverse_lazy
|
||||
|
||||
from sheets.models import Sheet
|
||||
|
||||
|
||||
class SheetTable(tables.Table):
|
||||
class Meta:
|
||||
attrs = {
|
||||
'class': 'table table-condensed table-striped table-hover'
|
||||
}
|
||||
model = Sheet
|
||||
template_name = 'django_tables2/bootstrap4.html'
|
||||
fields = ('name', 'date', )
|
||||
row_attrs = {
|
||||
'class': 'table-row',
|
||||
'id': lambda record: "row-" + str(record.pk),
|
||||
'data-href': lambda record: reverse_lazy('sheets:sheet_detail', args=(record.pk,))
|
||||
}
|
||||
Reference in New Issue
Block a user