mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-11-07 23:39:50 +01:00
Add model Recipe
This commit is contained in:
@@ -7,7 +7,7 @@ from note_kfet.middlewares import get_current_request
|
||||
from note.templatetags.pretty_money import pretty_money
|
||||
from permission.backends import PermissionBackend
|
||||
|
||||
from .models import Food, Dish, Order
|
||||
from .models import Food, Dish, Order, Recipe
|
||||
|
||||
|
||||
class FoodTable(tables.Table):
|
||||
@@ -115,3 +115,21 @@ class OrderTable(tables.Table):
|
||||
'class': 'table-row',
|
||||
'style': 'cursor:pointer',
|
||||
}
|
||||
|
||||
|
||||
class RecipeTable(tables.Table):
|
||||
"""
|
||||
List all recipes
|
||||
"""
|
||||
def render_ingredients(self, record):
|
||||
return ", ".join(str(q) for q in record.ingredients)
|
||||
|
||||
class Meta:
|
||||
model = Recipe
|
||||
template_name = 'django_tables2/bootstrap4.html'
|
||||
fields = ('name', 'creater', 'ingredients',)
|
||||
row_attrs = {
|
||||
'class': 'table-row',
|
||||
'data-href': lambda record: str(record.pk),
|
||||
'style': 'cursor:pointer',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user