From 629c0b0f6c09ecc1e3e36222e3f719552e18dfb4 Mon Sep 17 00:00:00 2001 From: Ian leggett <> Date: Thu, 24 Oct 2024 16:26:49 +0100 Subject: [PATCH] fix: add template filter to correctly format the table name --- .../apps/datasets/templatetags/datasets_tags.py | 5 +++++ .../datasets/details/sourceset_dataset.html | 4 ++-- .../tests/datasets/test_datasets_tags.py | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 dataworkspace/dataworkspace/tests/datasets/test_datasets_tags.py diff --git a/dataworkspace/dataworkspace/apps/datasets/templatetags/datasets_tags.py b/dataworkspace/dataworkspace/apps/datasets/templatetags/datasets_tags.py index 4b744c3297..096defcf76 100644 --- a/dataworkspace/dataworkspace/apps/datasets/templatetags/datasets_tags.py +++ b/dataworkspace/dataworkspace/apps/datasets/templatetags/datasets_tags.py @@ -182,3 +182,8 @@ def saved_grid_config(user, source): @register.filter def timedelta_to_minutes(td): return round(td.total_seconds() / 60, 2) + + +@register.filter +def format_table_name(table_name): + return table_name.capitalize().replace("_", " ") diff --git a/dataworkspace/dataworkspace/templates/datasets/details/sourceset_dataset.html b/dataworkspace/dataworkspace/templates/datasets/details/sourceset_dataset.html index 90ef604b07..0c66768ffe 100644 --- a/dataworkspace/dataworkspace/templates/datasets/details/sourceset_dataset.html +++ b/dataworkspace/dataworkspace/templates/datasets/details/sourceset_dataset.html @@ -117,11 +117,11 @@