1
0
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:
2022-08-18 14:27:02 +02:00
parent 44994a3ae7
commit 51e5e3669e
15 changed files with 591 additions and 49 deletions

22
apps/sheets/tables.py Normal file
View 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,))
}