From 2e0aee089b3f0a87c8f1c59eed87308e02c2f138 Mon Sep 17 00:00:00 2001 From: Hongwei Date: Tue, 12 Dec 2023 13:55:35 +0100 Subject: [PATCH] refactor/display milliseconds instead of microseconds for metric page --- apimanager/metrics/templates/metrics/api.html | 2 +- apimanager/metrics/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apimanager/metrics/templates/metrics/api.html b/apimanager/metrics/templates/metrics/api.html index b335207c..b4ac7132 100644 --- a/apimanager/metrics/templates/metrics/api.html +++ b/apimanager/metrics/templates/metrics/api.html @@ -170,7 +170,7 @@

{% trans "Filter" %}

{{ metric.url }} {{ metric.source_ip}} {{ metric.target_ip }} - {{ metric.date|date:"Y-m-d H:i:s.u" }} + {{ metric.date}} {{ metric.duration }} diff --git a/apimanager/metrics/views.py b/apimanager/metrics/views.py index c697acfc..d8413846 100644 --- a/apimanager/metrics/views.py +++ b/apimanager/metrics/views.py @@ -115,7 +115,7 @@ def to_django(self, metrics): """ for metric in metrics: metric['date'] = datetime.datetime.strptime( - metric['date'], settings.API_DATE_FORMAT_WITH_SECONDS ) + metric['date'], settings.API_DATE_FORMAT_WITH_MILLISECONDS).isoformat(timespec='milliseconds') return metrics def to_api(self, cleaned_data):