From 8a6f72ca838e9364f7c4dfe7effb20789fbdd9c6 Mon Sep 17 00:00:00 2001 From: bkfox Date: Fri, 12 Apr 2024 16:36:05 +0200 Subject: [PATCH] imrpove statistics rendering + filters --- aircox/models/log.py | 3 + .../aircox/dashboard/statistics.html | 108 ++++++++++-------- aircox/views/dashboard.py | 2 +- aircox/views/log.py | 67 +++++++---- aircox/views/mixins.py | 8 +- 5 files changed, 112 insertions(+), 76 deletions(-) diff --git a/aircox/models/log.py b/aircox/models/log.py index a58f2fe..9bf0e5b 100644 --- a/aircox/models/log.py +++ b/aircox/models/log.py @@ -33,6 +33,9 @@ class LogQuerySet(models.QuerySet): def after(self, date): return self.filter(date__gte=date) if isinstance(date, tz.datetime) else self.filter(date__date__gte=date) + def before(self, date): + return self.filter(date__lte=date) if isinstance(date, tz.datetime) else self.filter(date__date__lte=date) + def on_air(self): return self.filter(type=Log.TYPE_ON_AIR) diff --git a/aircox/templates/aircox/dashboard/statistics.html b/aircox/templates/aircox/dashboard/statistics.html index 785de35..4e17766 100644 --- a/aircox/templates/aircox/dashboard/statistics.html +++ b/aircox/templates/aircox/dashboard/statistics.html @@ -6,15 +6,20 @@ {% block content-container %}
-{# TODO: date subtitle #} -{% comment %} - -{% endcomment %} - +
+

{% translate "Filter by date" %}

+
+
+ + +
+
+ + +
+ +
+