From 399f581d860d7ccc922d4c1869a2ed31ed051dab Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Wed, 2 May 2018 22:28:02 +0200 Subject: [PATCH] more generic views --- cookbook/tables.py | 3 ++ cookbook/templates/base.html | 12 ++++- .../templates/generic/delete_template.html | 10 ++-- cookbook/templates/generic/edit_template.html | 7 +-- cookbook/templates/index.html | 4 +- cookbook/urls.py | 1 + cookbook/views/edit.py | 46 +++++++++++++++++++ 7 files changed, 70 insertions(+), 13 deletions(-) diff --git a/cookbook/tables.py b/cookbook/tables.py index 1ffb4524..160e3e95 100644 --- a/cookbook/tables.py +++ b/cookbook/tables.py @@ -13,6 +13,7 @@ class RecipeTable(tables.Table): attrs={'td': {'class': 'd-none d-lg-table-cell'}, 'th': {'class': 'd-none d-lg-table-cell'}}) all_tags = tables.Column( attrs={'td': {'class': 'd-none d-lg-table-cell'}, 'th': {'class': 'd-none d-lg-table-cell'}}) + delete = tables.TemplateColumn("" + _('Delete') + "") # TODO remove and put into edit page class Meta: model = Recipe @@ -22,6 +23,7 @@ class RecipeTable(tables.Table): class CategoryTable(tables.Table): id = tables.LinkColumn('edit_category', args=[A('id')]) + delete = tables.TemplateColumn("" + _('Delete') + "") class Meta: model = Category @@ -31,6 +33,7 @@ class CategoryTable(tables.Table): class KeywordTable(tables.Table): id = tables.LinkColumn('edit_keyword', args=[A('id')]) + delete = tables.TemplateColumn("" + _('Delete') + "") class Meta: model = Keyword diff --git a/cookbook/templates/base.html b/cookbook/templates/base.html index 2e2556e1..3a2bf876 100644 --- a/cookbook/templates/base.html +++ b/cookbook/templates/base.html @@ -41,7 +41,7 @@ +