From 4ebf03e96da882e0b895706f7b2316cd00a3052a Mon Sep 17 00:00:00 2001 From: Dobin Date: Fri, 17 Mar 2023 12:30:04 +0100 Subject: [PATCH] ui: make numbers nicer --- app/templates/file_info.html | 2 +- app/templates/file_matches.html | 2 +- app/templates/list_files_results.html | 2 +- app/views.py | 6 +++++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/templates/file_info.html b/app/templates/file_info.html index 06794ab..9ca2665 100644 --- a/app/templates/file_info.html +++ b/app/templates/file_info.html @@ -6,7 +6,7 @@ {{outcome.fileInfo.name}} Size: - {{outcome.fileInfo.size}} bytes + {{outcome.fileInfo.size|prettynumber}} bytes Type: {{outcome.fileInfo.ident}} diff --git a/app/templates/file_matches.html b/app/templates/file_matches.html index 7d56b11..416e163 100644 --- a/app/templates/file_matches.html +++ b/app/templates/file_matches.html @@ -12,7 +12,7 @@ {% endfor %} diff --git a/app/templates/list_files_results.html b/app/templates/list_files_results.html index 51e48f7..4d3e9ba 100644 --- a/app/templates/list_files_results.html +++ b/app/templates/list_files_results.html @@ -26,7 +26,7 @@ {% endif %} - {{outcome.fileInfo.size}} + {{outcome.fileInfo.size|prettynumber}} {{outcome.fileInfo.ident}} {{outcome.matches|length}} diff --git a/app/views.py b/app/views.py index 36aa531..4a262d4 100644 --- a/app/views.py +++ b/app/views.py @@ -272,4 +272,8 @@ def hex_filter(s): @views.app_template_filter('mydate') def date_filter(s): - return s.strftime('%Y-%m-%d %H:%M:%S') \ No newline at end of file + return s.strftime('%Y-%m-%d %H:%M:%S') + +@views.app_template_filter('prettynumber') +def date_filter(s): + return f"{s:,}"