mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-21 01:48:21 +02:00
Rewrite food apps, new feature some changes to model
This commit is contained in:
21
apps/food/tables.py
Normal file
21
apps/food/tables.py
Normal 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',
|
||||
}
|
Reference in New Issue
Block a user