From f6aa50bbfce276e80b31b8b95dd43d13a023c722 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Mon, 11 May 2020 12:59:54 +0200 Subject: [PATCH] added history page --- cookbook/tables.py | 18 ++++++++++++++++ cookbook/templates/base.html | 3 ++- cookbook/templates/history.html | 37 +++++++++++++++++++++++++++++++++ cookbook/templates/index.html | 1 - cookbook/urls.py | 1 + cookbook/views/views.py | 10 +++++++-- 6 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 cookbook/templates/history.html diff --git a/cookbook/tables.py b/cookbook/tables.py index b9ace14b..1ee7b941 100644 --- a/cookbook/tables.py +++ b/cookbook/tables.py @@ -106,3 +106,21 @@ class RecipeImportTable(tables.Table): model = RecipeImport template_name = 'generic/table_template.html' fields = ('id', 'name', 'file_path') + + +class ViewLogTable(tables.Table): + recipe = tables.LinkColumn('view_recipe', args=[A('recipe_id')]) + + class Meta: + model = ViewLog + template_name = 'generic/table_template.html' + fields = ('recipe', 'created_at') + + +class CookLogTable(tables.Table): + recipe = tables.LinkColumn('view_recipe', args=[A('recipe_id')]) + + class Meta: + model = CookLog + template_name = 'generic/table_template.html' + fields = ('recipe', 'rating', 'serving', 'created_at') diff --git a/cookbook/templates/base.html b/cookbook/templates/base.html index 945d50fc..f499e9f1 100644 --- a/cookbook/templates/base.html +++ b/cookbook/templates/base.html @@ -128,7 +128,7 @@