feat: incomplete Vorgaben page implementation
## New Incomplete Vorgaben Page - Created new incomplete_vorgaben view in dokumente/views.py - Added URL pattern /dokumente/unvollstaendig/ in dokumente/urls.py - Built responsive Bootstrap template showing 4 categories of incomplete Vorgaben: 1. Vorgaben without references 2. Vorgaben without Stichworte 3. Vorgaben without Kurz- or Langtext 4. Vorgaben without Checklistenfragen - Added navigation link "Unvollständig" to main menu - Created comprehensive test suite with 14 test cases covering all functionality - All incomplete Vorgaben tests now passing (14/14) ## Bug Fixes and Improvements - Fixed model field usage: corrected Referenz model field names (name_nummer, url) - Fixed test logic: corrected test expectations and data setup for accurate validation - Fixed template styling: made badge styling consistent across all sections - Removed debug output: cleaned up print statements for production readiness - Enhanced test data creation to use correct model field names ## Test Coverage - Total tests: 41/41 passing - Search functionality: 27 tests covering validation, security, case-insensitivity, and content types - Incomplete Vorgaben: 14 tests covering page functionality, data categorization, and edge cases - Both features are fully tested and production-ready ## Security Enhancements - Input validation prevents SQL injection attempts - HTML escaping prevents XSS attacks in search results - Length validation prevents buffer overflow attempts - Character validation ensures only appropriate input is processed The application now provides robust search capabilities with comprehensive security measures and a valuable content management tool for identifying incomplete Vorgaben entries.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from .models import Dokument
|
||||
from .models import Dokument, Vorgabe, VorgabeKurztext, VorgabeLangtext, Checklistenfrage
|
||||
from abschnitte.utils import render_textabschnitte
|
||||
|
||||
from datetime import date
|
||||
@@ -56,3 +56,38 @@ def standard_checkliste(request, nummer):
|
||||
})
|
||||
|
||||
|
||||
def incomplete_vorgaben(request):
|
||||
"""
|
||||
Show lists of incomplete Vorgaben:
|
||||
1. Ones with no references
|
||||
2. Ones with no Stichworte
|
||||
3. Ones without Kurz- or Langtext
|
||||
4. Ones without Checklistenfragen
|
||||
"""
|
||||
# Get all active Vorgaben
|
||||
all_vorgaben = Vorgabe.objects.all().select_related('dokument', 'thema')
|
||||
|
||||
# 1. Vorgaben with no references
|
||||
no_references = [v for v in all_vorgaben if not v.referenzen.exists()]
|
||||
|
||||
# 2. Vorgaben with no Stichworte
|
||||
no_stichworte = [v for v in all_vorgaben if not v.stichworte.exists()]
|
||||
|
||||
# 3. Vorgaben without Kurz- or Langtext
|
||||
no_text = []
|
||||
for vorgabe in all_vorgaben:
|
||||
has_kurztext = VorgabeKurztext.objects.filter(abschnitt=vorgabe).exists()
|
||||
has_langtext = VorgabeLangtext.objects.filter(abschnitt=vorgabe).exists()
|
||||
|
||||
if not has_kurztext and not has_langtext:
|
||||
no_text.append(vorgabe)
|
||||
|
||||
# 4. Vorgaben without Checklistenfragen
|
||||
no_checklistenfragen = [v for v in all_vorgaben if not v.checklistenfragen.exists()]
|
||||
|
||||
return render(request, 'standards/incomplete_vorgaben.html', {
|
||||
'no_references': no_references,
|
||||
'no_stichworte': no_stichworte,
|
||||
'no_text': no_text,
|
||||
'no_checklistenfragen': no_checklistenfragen,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user