From 3b1713015304fdd0513c0c4ebedcc10b5cfb8ee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Schl=C3=B6gl?= Date: Tue, 5 Mar 2024 16:49:51 +0100 Subject: [PATCH] feat(apis_history): adds table for viewing apis history records --- apis_core/apis_history/tables.py | 20 +++++++++++++++++++ .../apis_history/columns/description.html | 2 ++ 2 files changed, 22 insertions(+) create mode 100644 apis_core/apis_history/tables.py create mode 100644 apis_core/apis_history/templates/apis_history/columns/description.html diff --git a/apis_core/apis_history/tables.py b/apis_core/apis_history/tables.py new file mode 100644 index 000000000..d8ff44dd6 --- /dev/null +++ b/apis_core/apis_history/tables.py @@ -0,0 +1,20 @@ +from apis_core.generic.tables import CustomTemplateColumn, ViewColumn +import django_tables2 as tables + + +class DescriptionColumnHistory(CustomTemplateColumn): + """ + A column showing a model description + """ + + template_name = "apis_history/columns/description.html" + orderable = False + + +class APISHistoryTableBaseTable(tables.Table): + history_id = tables.Column(verbose_name="ID") + desc = DescriptionColumnHistory() + view = ViewColumn() + + class Meta: + fields = ["history_id", "desc", "view"] diff --git a/apis_core/apis_history/templates/apis_history/columns/description.html b/apis_core/apis_history/templates/apis_history/columns/description.html new file mode 100644 index 000000000..e3109ba9d --- /dev/null +++ b/apis_core/apis_history/templates/apis_history/columns/description.html @@ -0,0 +1,2 @@ +{% load apisgeneric %} +{{ record }} \ No newline at end of file