diff --git a/CHANGELOG b/CHANGELOG index 53d39bc..2cb5a2b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +v1.2.1 20221111 JP + - Fix link form saving bug + - Make metrics entry dates Central time aware since log entries do have a UTC timzeone + - When log entries are display, make it clear they are in UTC + - Display APP_VERSION / GitHub tag in header + - Show (username) in logout link + v1.2.0 20221107 JP - More opsres to serviceindex changes - Convert to use ModelForms diff --git a/Operations_ServiceIndex_Django/Operations_ServiceIndex_Django/settings.py b/Operations_ServiceIndex_Django/Operations_ServiceIndex_Django/settings.py index bf9fa41..691cef1 100644 --- a/Operations_ServiceIndex_Django/Operations_ServiceIndex_Django/settings.py +++ b/Operations_ServiceIndex_Django/Operations_ServiceIndex_Django/settings.py @@ -43,6 +43,7 @@ ALLOWED_HOSTS = CONF['ALLOWED_HOSTS'] +APP_VERSION = CONF['APP_VERSION'] # Application definition diff --git a/Operations_ServiceIndex_Django/services/views.py b/Operations_ServiceIndex_Django/services/views.py index 2229d9b..259b210 100644 --- a/Operations_ServiceIndex_Django/services/views.py +++ b/Operations_ServiceIndex_Django/services/views.py @@ -6,7 +6,8 @@ from django.template.loader import get_template from django.template import Context from django.utils import timezone -from datetime import datetime, timedelta +from datetime import datetime, timedelta, time +from zoneinfo import ZoneInfo from django.contrib.auth.decorators import login_required, user_passes_test from django.conf import settings @@ -186,6 +187,9 @@ def update_service(request): # initial=[{'service': service_id, 'service_id': service_id}]) for link_form in link_formset: link_form.instance.service_id = service_id + if link_form.has_changed(): + if link_form.is_valid(): + link_form.save() # if link_form.has_changed(): ## and link_form.changed_data != ['service']: ## link_form.service = service @@ -319,8 +323,8 @@ def export(request): # render plain text listing response = http.HttpResponse(content_type='text/plain') t = get_template('services/export.txt') - context = Context({'services':services}) - response.write(t.render(context)) + context = {'services':services} + response.write(t.render(context, request)) return response else: @@ -529,9 +533,9 @@ def metrics(request): form = MetricsForm(request.POST) if form.is_valid(): if form.cleaned_data['start_date']: - start = form.cleaned_data['start_date'] + start = datetime.combine(form.cleaned_data['start_date'], time.min, tzinfo=ZoneInfo("US/Central")) if form.cleaned_data['end_date']: - end = form.cleaned_data['end_date'] + end = datetime.combine(form.cleaned_data['end_date'], time.max, tzinfo=ZoneInfo("US/Central")) else: end = timezone.now() week = timedelta(days=7) diff --git a/Operations_ServiceIndex_Django/templates/services/base.html b/Operations_ServiceIndex_Django/templates/services/base.html index 2908e3d..b86233a 100644 --- a/Operations_ServiceIndex_Django/templates/services/base.html +++ b/Operations_ServiceIndex_Django/templates/services/base.html @@ -1,4 +1,5 @@ {% load static %} +{% load get_settings %}
@@ -20,6 +21,7 @@LOG:
+LOG (UTC):
Timestmaps are in UTC