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

Rewrite food apps, new feature some changes to model

This commit is contained in:
quark
2025-04-22 19:52:32 +02:00
parent 485d093002
commit 6d6583bfe6
19 changed files with 1693 additions and 34 deletions

21
apps/food/tables.py Normal file
View File

@ -0,0 +1,21 @@
# Copyright (C) 2018-2025 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
import django_tables2 as tables
from .models import Food
class FoodTable(tables.Table):
"""
List all foods.
"""
class Meta:
model = Food
template_name = 'django_tables2/bootstrap4.html'
fields = ('name', 'owner', 'allergens', 'expiry_date')
row_attrs = {
'class': 'table-row',
'data-href': lambda record: 'detail/' + str(record.pk),
'style': 'cursor:pointer',
}