1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-04-23 23:22:38 +00:00
nk20/apps/food/tables.py

22 lines
552 B
Python

# 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',
}