From bc1541050d4e8ce7c811b2fecddc7b26374c87a0 Mon Sep 17 00:00:00 2001 From: Klaas van Schelven Date: Wed, 19 Feb 2025 16:46:59 +0100 Subject: [PATCH] thousand-separators for counts useful when there are very many events --- bugsink/settings/default.py | 1 + issues/templates/issues/base.html | 5 +++-- issues/templates/issues/breadcrumbs.html | 3 ++- issues/templates/issues/event_details.html | 3 ++- issues/templates/issues/event_list.html | 5 +++-- issues/templates/issues/issue_list.html | 7 ++++--- issues/templates/issues/stacktrace.html | 5 +++-- 7 files changed, 18 insertions(+), 11 deletions(-) diff --git a/bugsink/settings/default.py b/bugsink/settings/default.py index f42e4e8..e4d693e 100644 --- a/bugsink/settings/default.py +++ b/bugsink/settings/default.py @@ -59,6 +59,7 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'django.contrib.humanize', 'tailwind', # As currently set up, this is also needed in production (templatetags) 'admin_auto_filters', diff --git a/issues/templates/issues/base.html b/issues/templates/issues/base.html index d6d3d52..fceaa37 100644 --- a/issues/templates/issues/base.html +++ b/issues/templates/issues/base.html @@ -1,6 +1,7 @@ {% extends "base.html" %} {% load static %} {% load issues %} +{% load humanize %} {% load stricter_templates %} {% block title %}{{ issue.title }} · {{ block.super }}{% endblock %} @@ -119,7 +120,7 @@
- {% if is_event_page %}
Event {{ event.digest_order }} of {{ issue.digested_event_count}} which occured at {{ event.ingested_at|date:"j M G:i T" }}
{% endif %} + {% if is_event_page %}
Event {{ event.digest_order|intcomma }} of {{ issue.digested_event_count|intcomma }} which occured at {{ event.ingested_at|date:"j M G:i T" }}
{% endif %}
{% if is_event_page %} Download @@ -183,7 +184,7 @@
Nr. of events:
-
{{ issue.digested_event_count }}
+
{{ issue.digested_event_count|intcomma }}
{% if issue.digested_event_count > 1 %} diff --git a/issues/templates/issues/breadcrumbs.html b/issues/templates/issues/breadcrumbs.html index bba97f6..204b1bf 100644 --- a/issues/templates/issues/breadcrumbs.html +++ b/issues/templates/issues/breadcrumbs.html @@ -2,12 +2,13 @@ {% load static %} {% load stricter_templates %} {% load issues %} +{% load humanize %} {% block tab_content %}
-
{{ event.ingested_at|date:"j M G:i T" }} (Event {{ event.digest_order }} of {{ issue.digested_event_count }})
+
{{ event.ingested_at|date:"j M G:i T" }} (Event {{ event.digest_order|intcomma }} of {{ issue.digested_event_count|intcomma }})
diff --git a/issues/templates/issues/event_details.html b/issues/templates/issues/event_details.html index 3869e6a..548593b 100644 --- a/issues/templates/issues/event_details.html +++ b/issues/templates/issues/event_details.html @@ -1,12 +1,13 @@ {% extends "issues/base.html" %} {% load static %} {% load stricter_templates %} +{% load humanize %} {% block tab_content %}
-
{{ event.ingested_at|date:"j M G:i T" }} (Event {{ event.digest_order }} of {{ issue.digested_event_count }})
+
{{ event.ingested_at|date:"j M G:i T" }} (Event {{ event.digest_order|intcomma }} of {{ issue.digested_event_count|intcomma }})
diff --git a/issues/templates/issues/event_list.html b/issues/templates/issues/event_list.html index f55c78c..d3fbc98 100644 --- a/issues/templates/issues/event_list.html +++ b/issues/templates/issues/event_list.html @@ -1,14 +1,15 @@ {% extends "issues/base.html" %} {% load issues %} +{% load humanize %} {% block tab_content %}
- Showing {{ page_obj.start_index }} - {{ page_obj.end_index }} of {{ page_obj.paginator.count }} + Showing {{ page_obj.start_index|intcomma }} - {{ page_obj.end_index|intcomma }} of {{ page_obj.paginator.count|intcomma }} {% if project.digested_event_count != project.stored_event_count %} - available events ({{ project.digested_event_count }} total observed). + available events ({{ project.digested_event_count|intcomma }} total observed). {% else %} total events. {% endif %} diff --git a/issues/templates/issues/issue_list.html b/issues/templates/issues/issue_list.html index 05f91d1..ab2ead7 100644 --- a/issues/templates/issues/issue_list.html +++ b/issues/templates/issues/issue_list.html @@ -1,5 +1,6 @@ {% extends "base.html" %} {% load static add_to_qs %} +{% load humanize %} {% block title %}Issues · {{ project.name }} · {{ site_title }}{% endblock %} @@ -143,7 +144,7 @@   {% endif %}{{ issue.title|truncatechars:100 }}
-
from {{ issue.first_seen|date:"j M G:i T" }} | last {{ issue.last_seen|date:"j M G:i T" }} | with {{ issue.digested_event_count }} events +
from {{ issue.first_seen|date:"j M G:i T" }} | last {{ issue.last_seen|date:"j M G:i T" }} | with {{ issue.digested_event_count|intcomma }} events {% if issue.transaction %}| {{ issue.transaction }} {% endif %}
@@ -191,9 +192,9 @@ {% endif %} {% if page_obj.paginator.num_pages > 1 %} - Issues {{ page_obj.start_index }}–{{ page_obj.end_index }} of {{ page_obj.paginator.count }} + Issues {{ page_obj.start_index|intcomma }}–{{ page_obj.end_index|intcomma }} of {{ page_obj.paginator.count|intcomma }} {% elif page_obj.paginator.count > 0 %} - {{ page_obj.paginator.count }} Issues + {{ page_obj.paginator.count|intcomma }} Issues {% endif %} {% if page_obj.has_next %} diff --git a/issues/templates/issues/stacktrace.html b/issues/templates/issues/stacktrace.html index 8333d52..c4bb7c6 100644 --- a/issues/templates/issues/stacktrace.html +++ b/issues/templates/issues/stacktrace.html @@ -2,6 +2,7 @@ {% load static %} {% load stricter_templates %} {% load issues %} +{% load humanize %} {% block tab_content %} @@ -9,7 +10,7 @@ {# event-nav only #}
-
{{ event.ingested_at|date:"j M G:i T" }} (Event {{ event.digest_order }} of {{ issue.digested_event_count }})
+
{{ event.ingested_at|date:"j M G:i T" }} (Event {{ event.digest_order|intcomma }} of {{ issue.digested_event_count|intcomma }})
@@ -30,7 +31,7 @@
{% if forloop.counter0 == 0 %} -
{{ event.ingested_at|date:"j M G:i T" }} (Event {{ event.digest_order }} of {{ issue.digested_event_count }})
+
{{ event.ingested_at|date:"j M G:i T" }} (Event {{ event.digest_order|intcomma }} of {{ issue.digested_event_count|intcomma }})
{% endif %}

{{ exception.type }}

{{ exception.value }}