From 0d7e63d3a224473047f0a55e1261d5a516e82e3f Mon Sep 17 00:00:00 2001
From: "Adrian A. Baumann"
Date: Mon, 8 Dec 2025 15:34:14 +0100
Subject: [PATCH] =?UTF-8?q?Changed=20"Historische=20Version..."=20to=20"Zu?=
=?UTF-8?q?k=C3=BCnftige=20Version..."=20when=20appropriate?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
argocd/deployment.yaml | 2 +-
.../templates/standards/standard_detail.html | 4 +++
dokumente/tests.py | 32 +++++++++++++++++++
dokumente/views.py | 2 ++
pages/templates/base.html | 2 +-
5 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/argocd/deployment.yaml b/argocd/deployment.yaml
index 356e373..2613a32 100644
--- a/argocd/deployment.yaml
+++ b/argocd/deployment.yaml
@@ -25,7 +25,7 @@ spec:
mountPath: /data
containers:
- name: web
- image: git.baumann.gr/adebaumann/vui:0.972
+ image: git.baumann.gr/adebaumann/vui:0.973
imagePullPolicy: Always
ports:
- containerPort: 8000
diff --git a/dokumente/templates/standards/standard_detail.html b/dokumente/templates/standards/standard_detail.html
index 4574cb3..45de3c2 100644
--- a/dokumente/templates/standards/standard_detail.html
+++ b/dokumente/templates/standards/standard_detail.html
@@ -16,7 +16,11 @@
{% if standard.history == True %}
+ {% if standard.is_future %}
+ Zukünftige Version vom {{ standard.check_date }}
+ {% else %}
Historische Version vom {{ standard.check_date }}
+ {% endif %}
{% endif %}
diff --git a/dokumente/tests.py b/dokumente/tests.py
index 3883439..ee80db6 100644
--- a/dokumente/tests.py
+++ b/dokumente/tests.py
@@ -493,6 +493,38 @@ class ViewsTestCase(TestCase):
url = reverse('standard_history', kwargs={'nummer': 'R01234'})
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
+
+ def test_standard_history_past_date_shows_historische(self):
+ """Test that past dates show 'Historische Version'"""
+ past_date = (date.today() - timedelta(days=30)).strftime('%Y-%m-%d')
+ url = f'/dokumente/R01234/history/{past_date}/'
+ response = self.client.get(url)
+ self.assertEqual(response.status_code, 200)
+ self.assertContains(response, 'Historische Version vom')
+ self.assertNotContains(response, 'Zukünftige Version vom')
+ # Verify is_future flag is False
+ self.assertFalse(response.context['standard'].is_future)
+
+ def test_standard_history_future_date_shows_zukuenftige(self):
+ """Test that future dates show 'Zukünftige Version'"""
+ future_date = (date.today() + timedelta(days=30)).strftime('%Y-%m-%d')
+ url = f'/dokumente/R01234/history/{future_date}/'
+ response = self.client.get(url)
+ self.assertEqual(response.status_code, 200)
+ self.assertContains(response, 'Zukünftige Version vom')
+ self.assertNotContains(response, 'Historische Version vom')
+ # Verify is_future flag is True
+ self.assertTrue(response.context['standard'].is_future)
+
+ def test_standard_detail_current_has_no_version_label(self):
+ """Test that current view (no history) has no version label"""
+ url = reverse('standard_detail', kwargs={'nummer': 'R01234'})
+ response = self.client.get(url)
+ self.assertEqual(response.status_code, 200)
+ self.assertNotContains(response, 'Historische Version vom')
+ self.assertNotContains(response, 'Zukünftige Version vom')
+ # Verify history flag is False
+ self.assertFalse(response.context['standard'].history)
class URLPatternsTest(TestCase):
diff --git a/dokumente/views.py b/dokumente/views.py
index 0ff3b93..d7856bd 100644
--- a/dokumente/views.py
+++ b/dokumente/views.py
@@ -29,9 +29,11 @@ def standard_detail(request, nummer,check_date=""):
if check_date:
check_date = calendar.parseDT(check_date)[0].date()
standard.history = True
+ standard.is_future = check_date > date.today()
else:
check_date = date.today()
standard.history = False
+ standard.is_future = False
standard.check_date=check_date
vorgaben = list(standard.vorgaben.order_by("thema","nummer").select_related("thema","dokument")) # convert queryset to list so we can attach attributes
diff --git a/pages/templates/base.html b/pages/templates/base.html
index f910596..087c085 100644
--- a/pages/templates/base.html
+++ b/pages/templates/base.html
@@ -219,7 +219,7 @@
-
Version {{ version|default:"0.972" }}
+
Version {{ version|default:"0.973" }}