Compare commits

...

13 Commits

Author SHA1 Message Date
4504e8a2a5 Database updated with collaborators
All checks were successful
SonarQube Scan / SonarQube Trigger (push) Successful in 53s
2025-12-08 16:26:25 +01:00
502dd85efb Document import management command updated to work with changed structure 2025-12-08 16:26:03 +01:00
9e6e2b5a03 Workflow: Changed description (old vs new was obsolete)
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 4s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 4s
SonarQube Scan / SonarQube Trigger (push) Successful in 55s
2025-12-08 16:01:07 +01:00
c492b7bda6 New Preload-DB-image
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 4s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 11s
SonarQube Scan / SonarQube Trigger (push) Successful in 55s
2025-12-08 15:59:13 +01:00
0d7e63d3a2 Changed "Historische Version..." to "Zukünftige Version..." when appropriate
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 16s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 4s
SonarQube Scan / SonarQube Trigger (push) Successful in 55s
2025-12-08 15:34:14 +01:00
0866e604bc Documentation change regarding diagram cache
All checks were successful
SonarQube Scan / SonarQube Trigger (push) Successful in 55s
2025-12-08 15:01:14 +01:00
753c00bc45 Validation for 'Thema' on Vorgabe added
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 14s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 4s
SonarQube Scan / SonarQube Trigger (push) Successful in 54s
2025-12-08 14:41:02 +01:00
74d2f15d6a Package versions lifted for urllib and django due to trivy scan
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 39s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 4s
SonarQube Scan / SonarQube Trigger (push) Successful in 59s
2025-12-08 14:23:37 +01:00
615908e569 Password miminum length: 12
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 20s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 4s
SonarQube Scan / SonarQube Trigger (push) Successful in 56s
2025-12-08 12:34:09 +01:00
55d467ee58 Deployment 963
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 16s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 4s
SonarQube Scan / SonarQube Trigger (push) Successful in 56s
2025-12-04 14:28:40 +01:00
5a1df7345d UI element added
All checks were successful
SonarQube Scan / SonarQube Trigger (push) Successful in 55s
2025-12-04 14:26:35 +01:00
e3c5f6a9d7 Last date removed from array - tests adapted 2025-12-04 14:16:18 +01:00
a26290fc92 Date array calculation for documents added
All checks were successful
SonarQube Scan / SonarQube Trigger (push) Successful in 57s
2025-12-04 14:08:18 +01:00
14 changed files with 528 additions and 7 deletions

View File

@@ -60,7 +60,7 @@ jobs:
chmod +x /usr/local/bin/yq
yq --version
- name: Read ${{ matrix.description }} image from deployment (old vs new)
- name: Read ${{ matrix.description }} image from deployment
id: img
shell: bash
run: |

View File

@@ -540,5 +540,5 @@ digraph {
Bei Fragen oder Problemen mit Diagrammen:
1. Code auf https://kroki.io/ testen
2. Syntax-Dokumentation des jeweiligen Diagrammtyps konsultieren
3. Diagramm-Cache leeren: `python manage.py clear_diagram_cache`
3. (Nur mit Shell-Zugriff auf Kubernetes-Pod möglich): Diagramm-Cache leeren: `python manage.py clear_diagram_cache`
4. Bei technischen Problemen: Information Security Management BIT kontaktieren

View File

@@ -151,6 +151,24 @@ LOGIN_URL = 'login'
LOGIN_REDIRECT_URL = '/'
LOGOUT_REDIRECT_URL = 'login'
AUTH_PASSWORD_VALIDATORS = [
{
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
},
{
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
"OPTIONS": {
"min_length": 12,
},
},
{
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
},
{
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
},
]
#LOGGING = {
# "version": 1,
# "handlers" :{

View File

@@ -18,14 +18,14 @@ spec:
fsGroupChangePolicy: "OnRootMismatch"
initContainers:
- name: loader
image: git.baumann.gr/adebaumann/vui-data-loader:0.10
image: git.baumann.gr/adebaumann/vui-data-loader:0.11
command: [ "sh","-c","cp -n preload/preload.sqlite3 /data/db.sqlite3; chown -R 999:999 /data; ls -la /data; sleep 10; exit 0" ]
volumeMounts:
- name: data
mountPath: /data
containers:
- name: web
image: git.baumann.gr/adebaumann/vui:0.968
image: git.baumann.gr/adebaumann/vui:0.973
imagePullPolicy: Always
ports:
- containerPort: 8000

Binary file not shown.

Binary file not shown.

View File

@@ -94,9 +94,17 @@ class EinleitungInline(NestedStackedInline):
class VorgabeForm(forms.ModelForm):
referenzen = TreeNodeMultipleChoiceField(queryset=Referenz.objects.all(), required=False)
class Meta:
model = Vorgabe
fields = '__all__'
def clean_thema(self):
"""Validate that thema is provided."""
thema = self.cleaned_data.get('thema')
if not thema:
raise forms.ValidationError('Thema ist ein Pflichtfeld. Bitte wählen Sie ein Thema aus.')
return thema
class VorgabeInline(SortableInlineAdminMixin, NestedStackedInline):
model = Vorgabe

View File

@@ -71,6 +71,7 @@ class Command(BaseCommand):
"name": name,
"gueltigkeit_von": options["gueltigkeit_von"],
"gueltigkeit_bis": options["gueltigkeit_bis"],
"aktiv":False,
},
)
if created:
@@ -319,6 +320,7 @@ class Command(BaseCommand):
thema=thema,
titel=v["titel"],
gueltigkeit_von=timezone.now().date(),
order=0,
)
# Stichworte

View File

@@ -54,6 +54,34 @@ class Dokument(models.Model):
def __str__(self):
return f"{self.nummer} {self.name}"
@property
def dates(self):
"""
Returns an array of unique, chronologically sorted dates representing
state-change dates from all Vorgaben in this document.
These are dates where Vorgaben become active (gueltigkeit_von) or change state
(the day after gueltigkeit_bis). The very last date in the list is excluded
as it has no relevance (nothing changes after it).
"""
dates_set = set()
# Get all vorgaben for this document
for vorgabe in self.vorgaben.all():
# Add gueltigkeit_von (when vorgabe becomes active)
if vorgabe.gueltigkeit_von:
dates_set.add(vorgabe.gueltigkeit_von)
# Add the day after gueltigkeit_bis (when vorgabe expires/changes state)
# Only if gueltigkeit_bis is defined (not None)
if vorgabe.gueltigkeit_bis:
dates_set.add(vorgabe.gueltigkeit_bis + datetime.timedelta(days=1))
# Return sorted unique dates from oldest to newest, excluding the last date
# (but only if there are multiple dates; single dates are kept)
sorted_dates = sorted(list(dates_set))
return sorted_dates[:-1] if len(sorted_dates) > 1 else sorted_dates
class Meta:
verbose_name_plural="Dokumente"
verbose_name="Dokument"
@@ -141,6 +169,12 @@ class Vorgabe(models.Model):
"""
from django.core.exceptions import ValidationError
# Check that thema is provided
if not self.thema_id:
raise ValidationError({
'thema': 'Thema ist ein Pflichtfeld. Bitte wählen Sie ein Thema aus.'
})
# Check for conflicts with existing Vorgaben
conflicts = self.find_conflicts()
if conflicts:

View File

@@ -16,9 +16,32 @@
{% if standard.history == True %}
<div class="alert alert-warning" role="alert">
{% if standard.is_future %}
<strong>Zukünftige Version vom {{ standard.check_date }}</strong>
{% else %}
<strong>Historische Version vom {{ standard.check_date }}</strong>
{% endif %}
</div>
{% endif %}
<!-- History Dates Dropdown -->
{% if standard.dates %}
<div class="mb-3">
<div class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" style="text-decoration: none;">
📅 Historische Versionen
</a>
<ul class="dropdown-menu" role="menu">
<li><a href="/dokumente/{{ standard.nummer }}/">Aktuelle Version</a></li>
<li class="divider"></li>
{% for date in standard.dates %}
<li><a href="/dokumente/{{ standard.nummer }}/history/{{ date|date:'Y-m-d' }}/">{{ date|date:'d.m.Y' }}</a></li>
{% endfor %}
</ul>
</div>
</div>
{% endif %}
<!-- Einleitung -->
{% if standard.einleitung_html %}
<div class="row mb-4">

View File

@@ -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):
@@ -761,6 +793,134 @@ class VorgabeSanityCheckTest(TestCase):
self.assertIn("intersecting validity periods", report)
class VorgabeThemaValidationTest(TestCase):
"""Test cases for Vorgabe Thema validation"""
def setUp(self):
"""Set up test data for Thema validation tests"""
self.dokumententyp = Dokumententyp.objects.create(
name="Standard IT-Sicherheit",
verantwortliche_ve="SR-SUR-SEC"
)
self.dokument = Dokument.objects.create(
nummer="R0066",
dokumententyp=self.dokumententyp,
name="IT Security Standard",
aktiv=True
)
self.thema = Thema.objects.create(name="Organisation")
def test_vorgabe_with_thema_passes_validation(self):
"""Test that Vorgabe with a valid Thema passes clean() validation"""
vorgabe = Vorgabe(
order=1,
nummer=1,
dokument=self.dokument,
thema=self.thema,
titel="Test Vorgabe",
gueltigkeit_von=date.today()
)
# Should not raise any exception
try:
vorgabe.clean()
except Exception as e:
self.fail(f"clean() raised {e} unexpectedly!")
def test_vorgabe_without_thema_fails_validation(self):
"""Test that Vorgabe without Thema fails clean() validation"""
from django.core.exceptions import ValidationError
vorgabe = Vorgabe(
order=1,
nummer=1,
dokument=self.dokument,
thema=None, # No Thema
titel="Test Vorgabe",
gueltigkeit_von=date.today()
)
with self.assertRaises(ValidationError) as context:
vorgabe.clean()
# Check that the error message is about thema
self.assertIn('thema', context.exception.message_dict)
self.assertIn('Thema ist ein Pflichtfeld', str(context.exception))
def test_vorgabe_form_with_thema_is_valid(self):
"""Test that VorgabeForm with Thema is valid"""
from dokumente.admin import VorgabeForm
form_data = {
'order': 1,
'nummer': 1,
'dokument': self.dokument.pk,
'thema': self.thema.pk,
'titel': 'Test Vorgabe',
'gueltigkeit_von': date.today(),
}
form = VorgabeForm(data=form_data)
self.assertTrue(form.is_valid(), f"Form errors: {form.errors}")
def test_vorgabe_form_without_thema_is_invalid(self):
"""Test that VorgabeForm without Thema is invalid"""
from dokumente.admin import VorgabeForm
form_data = {
'order': 1,
'nummer': 1,
'dokument': self.dokument.pk,
'thema': '', # Empty/missing Thema
'titel': 'Test Vorgabe',
'gueltigkeit_von': date.today(),
}
form = VorgabeForm(data=form_data)
self.assertFalse(form.is_valid())
self.assertIn('thema', form.errors)
def test_vorgabe_form_thema_error_message_is_german(self):
"""Test that VorgabeForm shows German error message for missing Thema"""
from dokumente.admin import VorgabeForm
form_data = {
'order': 1,
'nummer': 1,
'dokument': self.dokument.pk,
'thema': '', # Empty/missing Thema
'titel': 'Test Vorgabe',
'gueltigkeit_von': date.today(),
}
form = VorgabeForm(data=form_data)
form.is_valid()
# Check that the error message is in German
thema_errors = form.errors.get('thema', [])
error_messages = ' '.join(thema_errors)
self.assertTrue(
'Pflichtfeld' in error_messages or 'pflichtfeld' in error_messages.lower(),
f"Expected German error message about Pflichtfeld, got: {thema_errors}"
)
def test_vorgabe_model_clean_error_message_is_german(self):
"""Test that Vorgabe.clean() shows German error message for missing Thema"""
from django.core.exceptions import ValidationError
vorgabe = Vorgabe(
order=1,
nummer=1,
dokument=self.dokument,
thema=None,
titel="Test Vorgabe",
gueltigkeit_von=date.today()
)
with self.assertRaises(ValidationError) as context:
vorgabe.clean()
# Check error message is in German
error_str = str(context.exception)
self.assertIn('Thema ist ein Pflichtfeld', error_str)
class SanityCheckManagementCommandTest(TestCase):
"""Test cases for sanity_check_vorgaben management command"""
@@ -1792,6 +1952,279 @@ class GetVorgabeCommentsViewTest(TestCase):
self.assertEqual(response['X-Content-Type-Options'], 'nosniff')
class DokumentDatesPropertyTest(TestCase):
"""Test cases for Dokument.dates property"""
def setUp(self):
"""Set up test data for dates property tests"""
self.dokumententyp = Dokumententyp.objects.create(
name="Standard IT-Sicherheit",
verantwortliche_ve="SR-SUR-SEC"
)
self.dokument = Dokument.objects.create(
nummer="R0066",
dokumententyp=self.dokumententyp,
name="IT Security Standard",
aktiv=True
)
self.thema = Thema.objects.create(name="Organisation")
def test_dates_property_no_vorgaben(self):
"""Test dates property returns empty list when dokument has no vorgaben"""
dates = self.dokument.dates
self.assertEqual(dates, [])
def test_dates_property_single_vorgabe_with_only_gueltigkeit_von(self):
"""Test dates property with single vorgabe with only gueltigkeit_von"""
vorgabe = Vorgabe.objects.create(
order=1,
nummer=1,
dokument=self.dokument,
thema=self.thema,
titel="Test Vorgabe",
gueltigkeit_von=date(2025, 1, 1)
)
dates = self.dokument.dates
self.assertEqual(len(dates), 1)
self.assertEqual(dates[0], date(2025, 1, 1))
def test_dates_property_single_vorgabe_with_both_dates(self):
"""Test dates property with single vorgabe with both gueltigkeit_von and gueltigkeit_bis"""
vorgabe = Vorgabe.objects.create(
order=1,
nummer=1,
dokument=self.dokument,
thema=self.thema,
titel="Test Vorgabe",
gueltigkeit_von=date(2025, 1, 1),
gueltigkeit_bis=date(2026, 1, 1)
)
dates = self.dokument.dates
# gueltigkeit_bis would add 2026-01-02, but that's the last date so it's excluded
self.assertEqual(len(dates), 1)
self.assertEqual(dates[0], date(2025, 1, 1))
def test_dates_property_multiple_vorgaben_different_dates(self):
"""Test dates property with multiple vorgaben with different dates"""
vorgabe1 = Vorgabe.objects.create(
order=1,
nummer=1,
dokument=self.dokument,
thema=self.thema,
titel="Vorgabe 1",
gueltigkeit_von=date(2025, 1, 1),
gueltigkeit_bis=date(2025, 6, 30)
)
vorgabe2 = Vorgabe.objects.create(
order=2,
nummer=2,
dokument=self.dokument,
thema=self.thema,
titel="Vorgabe 2",
gueltigkeit_von=date(2025, 7, 1),
gueltigkeit_bis=date(2026, 1, 1)
)
dates = self.dokument.dates
# Dates: 2025-01-01, 2025-07-01, 2026-01-02 (but last one excluded)
self.assertEqual(len(dates), 2)
self.assertIn(date(2025, 1, 1), dates) # Start of vorgabe1
self.assertIn(date(2025, 7, 1), dates) # End of vorgabe1 + 1 day = Start of vorgabe2 (deduplicated)
def test_dates_property_ensures_uniqueness(self):
"""Test dates property returns unique dates only"""
# Create two vorgaben with overlapping dates
vorgabe1 = Vorgabe.objects.create(
order=1,
nummer=1,
dokument=self.dokument,
thema=self.thema,
titel="Vorgabe A",
gueltigkeit_von=date(2025, 1, 1),
gueltigkeit_bis=date(2026, 1, 1)
)
vorgabe2 = Vorgabe.objects.create(
order=2,
nummer=2,
dokument=self.dokument,
thema=self.thema,
titel="Vorgabe B",
gueltigkeit_von=date(2025, 1, 1), # Same start date
gueltigkeit_bis=date(2026, 1, 1) # Same end date
)
dates = self.dokument.dates
# Both vorgaben have same dates, and the last date (2026-01-02) is excluded
self.assertEqual(len(dates), 1)
self.assertEqual(dates[0], date(2025, 1, 1))
def test_dates_property_sorted_chronologically(self):
"""Test dates property returns dates sorted from oldest to newest"""
# Create vorgaben in non-chronological order
vorgabe1 = Vorgabe.objects.create(
order=1,
nummer=1,
dokument=self.dokument,
thema=self.thema,
titel="Vorgabe 1",
gueltigkeit_von=date(2026, 1, 1)
)
vorgabe2 = Vorgabe.objects.create(
order=2,
nummer=2,
dokument=self.dokument,
thema=self.thema,
titel="Vorgabe 2",
gueltigkeit_von=date(2024, 1, 1)
)
vorgabe3 = Vorgabe.objects.create(
order=3,
nummer=3,
dokument=self.dokument,
thema=self.thema,
titel="Vorgabe 3",
gueltigkeit_von=date(2025, 1, 1)
)
dates = self.dokument.dates
# Dates are [2024-01-01, 2025-01-01, 2026-01-01] but the last one is excluded
self.assertEqual(len(dates), 2)
self.assertEqual(dates[0], date(2024, 1, 1))
self.assertEqual(dates[1], date(2025, 1, 1))
def test_dates_property_ignores_none_dates(self):
"""Test dates property ignores None date values"""
vorgabe1 = Vorgabe.objects.create(
order=1,
nummer=1,
dokument=self.dokument,
thema=self.thema,
titel="Vorgabe 1",
gueltigkeit_von=date(2025, 1, 1)
# No gueltigkeit_bis (None)
)
vorgabe2 = Vorgabe.objects.create(
order=2,
nummer=2,
dokument=self.dokument,
thema=self.thema,
titel="Vorgabe 2",
gueltigkeit_von=date(2026, 1, 1),
gueltigkeit_bis=None # Explicitly None
)
dates = self.dokument.dates
# Dates are 2025-01-01 and 2026-01-01, but the last date (2026-01-01) is excluded
self.assertEqual(len(dates), 1)
self.assertEqual(dates[0], date(2025, 1, 1))
def test_dates_property_complex_scenario(self):
"""Test dates property with complex real-world scenario
Vorgabe A: 2025-01-01 to 2025-12-31
Vorgabe B: 2025-06-01 to 2026-01-01 (overlaps with A)
Vorgabe C: 2026-02-01 to None (no end date)
Expected dates: [2025-01-01, 2025-06-01, 2025-12-31, 2026-01-01, 2026-02-01]
The middle date (2026-01-01) should NOT be excluded even though B overlaps with A
"""
vorgabe_a = Vorgabe.objects.create(
order=1,
nummer=1,
dokument=self.dokument,
thema=self.thema,
titel="Vorgabe A",
gueltigkeit_von=date(2025, 1, 1),
gueltigkeit_bis=date(2025, 12, 31)
)
vorgabe_b = Vorgabe.objects.create(
order=2,
nummer=2,
dokument=self.dokument,
thema=self.thema,
titel="Vorgabe B",
gueltigkeit_von=date(2025, 6, 1),
gueltigkeit_bis=date(2026, 1, 1)
)
vorgabe_c = Vorgabe.objects.create(
order=3,
nummer=3,
dokument=self.dokument,
thema=self.thema,
titel="Vorgabe C",
gueltigkeit_von=date(2026, 2, 1)
# No gueltigkeit_bis
)
dates = self.dokument.dates
# All dates: 2025-01-01, 2025-06-01, 2026-01-01, 2026-01-02, 2026-02-01
# Last date (2026-02-01) is excluded
expected = [
date(2025, 1, 1), # Start of A
date(2025, 6, 1), # Start of B
date(2026, 1, 1), # End of A + 1 day
date(2026, 1, 2) # End of B + 1 day
]
self.assertEqual(dates, expected)
def test_dates_property_returns_list(self):
"""Test dates property returns a list (not a set or tuple)"""
vorgabe = Vorgabe.objects.create(
order=1,
nummer=1,
dokument=self.dokument,
thema=self.thema,
titel="Test Vorgabe",
gueltigkeit_von=date(2025, 1, 1)
)
dates = self.dokument.dates
self.assertIsInstance(dates, list)
def test_dates_property_does_not_persist_to_database(self):
"""Test dates property is calculated on-the-fly, not stored"""
vorgabe = Vorgabe.objects.create(
order=1,
nummer=1,
dokument=self.dokument,
thema=self.thema,
titel="Test Vorgabe",
gueltigkeit_von=date(2025, 1, 1),
gueltigkeit_bis=date(2025, 12, 31)
)
# Get dates before adding new vorgabe
dates_before = self.dokument.dates
self.assertEqual(len(dates_before), 1) # 2025-01-01 (2026-01-02 is last, so excluded)
# Add new vorgabe
vorgabe2 = Vorgabe.objects.create(
order=2,
nummer=2,
dokument=self.dokument,
thema=self.thema,
titel="Test Vorgabe 2",
gueltigkeit_von=date(2026, 2, 1)
)
# Get dates after - new dates are 2025-01-01, 2026-01-02, 2026-02-01
# Last date (2026-02-01) is excluded, so we get [2025-01-01, 2026-01-01]
dates_after = self.dokument.dates
self.assertEqual(len(dates_after), 2)
self.assertEqual(dates_after[0], date(2025, 1, 1))
self.assertEqual(dates_after[1], date(2026, 1, 1))
class AddVorgabeCommentViewTest(TestCase):
"""Test cases for add_vorgabe_comment view"""
@@ -2562,3 +2995,4 @@ class AllCommentsViewTest(TestCase):
# Both users' comments on the same vorgabe should be visible
self.assertEqual(response.context['total_comments'], 4)

View File

@@ -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

View File

@@ -219,7 +219,7 @@
</p>
</div>
<div class="col-sm-6 text-right">
<p class="text-muted">Version {{ version|default:"0.968" }}</p>
<p class="text-muted">Version {{ version|default:"0.973" }}</p>
</div>
</div>
</div>

View File

@@ -5,7 +5,7 @@ certifi==2025.8.3
charset-normalizer==3.4.3
curtsies==0.4.3
cwcwidth==0.1.10
Django==5.2.8
Django==5.2.9
django-admin-sortable2==2.2.8
django-js-asset==3.1.2
django-mptt==0.17.0
@@ -30,7 +30,7 @@ pyxdg==0.28
requests==2.32.5
six==1.17.0
sqlparse==0.5.3
urllib3==2.5.0
urllib3==2.6.0
wcwidth==0.2.13
bleach==6.1.0
coverage==7.6.1