Compare commits
10 Commits
complete-r
...
4b15c5f173
| Author | SHA1 | Date | |
|---|---|---|---|
| 4b15c5f173 | |||
| b8d5bc796d | |||
| 9bd4cb19d3 | |||
| 28f87509d6 | |||
| 9d4c7d5f87 | |||
| f7e6795c00 | |||
| 8520412867 | |||
| e94f61a697 | |||
| 0cd09d0878 | |||
| 994ba5d797 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -8,10 +8,11 @@ include/
|
||||
keys/
|
||||
.venv/
|
||||
.idea/
|
||||
|
||||
*.kate-swp
|
||||
node_modules/
|
||||
package-lock.json
|
||||
package.json
|
||||
# Diagram cache directory
|
||||
media/diagram_cache/
|
||||
.env
|
||||
data/db.sqlite3
|
||||
|
||||
@@ -28,7 +28,10 @@ RUN rm -rf /app/Dockerfile* \
|
||||
/app/k8s \
|
||||
/app/data-loader \
|
||||
/app/keys \
|
||||
/app/requirements.txt
|
||||
/app/requirements.txt \
|
||||
/app/node_modules \
|
||||
/app/*.json \
|
||||
/app/test_*.py
|
||||
RUN python3 manage.py collectstatic
|
||||
CMD ["gunicorn","--bind","0.0.0.0:8000","--workers","3","VorgabenUI.wsgi:application"]
|
||||
|
||||
|
||||
@@ -51,7 +51,6 @@ INSTALLED_APPS = [
|
||||
'mptt',
|
||||
'pages',
|
||||
'nested_admin',
|
||||
'revproxy.apps.RevProxyConfig',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
||||
@@ -18,7 +18,6 @@ from django.contrib import admin
|
||||
from django.urls import include, path, re_path
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
from diagramm_proxy.views import DiagrammProxyView
|
||||
import dokumente.views
|
||||
import pages.views
|
||||
import referenzen.views
|
||||
@@ -33,7 +32,6 @@ urlpatterns = [
|
||||
path('stichworte/', include("stichworte.urls")),
|
||||
path('referenzen/', referenzen.views.tree, name="referenz_tree"),
|
||||
path('referenzen/<str:refid>/', referenzen.views.detail, name="referenz_detail"),
|
||||
re_path(r'^diagramm/(?P<path>.*)$', DiagrammProxyView.as_view()),
|
||||
]
|
||||
|
||||
# Serve static files
|
||||
|
||||
@@ -25,7 +25,7 @@ spec:
|
||||
mountPath: /data
|
||||
containers:
|
||||
- name: web
|
||||
image: git.baumann.gr/adebaumann/vui:0.942
|
||||
image: git.baumann.gr/adebaumann/vui:0.945
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
|
||||
BIN
data/db.sqlite3
BIN
data/db.sqlite3
Binary file not shown.
@@ -1 +0,0 @@
|
||||
# Diagram proxy module
|
||||
@@ -1,4 +0,0 @@
|
||||
from revproxy.views import ProxyView
|
||||
|
||||
class DiagrammProxyView(ProxyView):
|
||||
upstream = "http://svckroki:8000/"
|
||||
@@ -2,6 +2,7 @@ from django.contrib import admin
|
||||
#from nested_inline.admin import NestedStackedInline, NestedModelAdmin
|
||||
from nested_admin import NestedStackedInline, NestedModelAdmin, NestedTabularInline
|
||||
from django import forms
|
||||
from django.utils.html import format_html
|
||||
from mptt.forms import TreeNodeMultipleChoiceField
|
||||
from mptt.admin import DraggableMPTTAdmin
|
||||
from adminsortable2.admin import SortableInlineAdminMixin, SortableAdminBase
|
||||
@@ -132,9 +133,57 @@ class StichworterklaerungInline(NestedTabularInline):
|
||||
|
||||
@admin.register(Stichwort)
|
||||
class StichwortAdmin(NestedModelAdmin):
|
||||
list_display = ('stichwort', 'vorgaben_count')
|
||||
search_fields = ('stichwort',)
|
||||
ordering=('stichwort',)
|
||||
inlines=[StichworterklaerungInline]
|
||||
readonly_fields = ('vorgaben_list',)
|
||||
fieldsets = (
|
||||
(None, {
|
||||
'fields': ('stichwort', 'vorgaben_list')
|
||||
}),
|
||||
)
|
||||
|
||||
def vorgaben_count(self, obj):
|
||||
"""Count the number of Vorgaben that have this Stichwort"""
|
||||
count = obj.vorgabe_set.count()
|
||||
return f"{count} Vorgabe{'n' if count != 1 else ''}"
|
||||
vorgaben_count.short_description = "Anzahl Vorgaben"
|
||||
|
||||
def vorgaben_list(self, obj):
|
||||
"""Display list of Vorgaben that use this Stichwort"""
|
||||
vorgaben = obj.vorgabe_set.select_related('dokument', 'thema').order_by('dokument__nummer', 'nummer')
|
||||
vorgaben_list = list(vorgaben) # Evaluate queryset once
|
||||
count = len(vorgaben_list)
|
||||
|
||||
if count == 0:
|
||||
return format_html("<em>Keine Vorgaben gefunden</em><p><strong>Gesamt: 0 Vorgaben</strong></p>")
|
||||
|
||||
html = "<div style='max-height: 300px; overflow-y: auto;'>"
|
||||
html += "<table style='width: 100%; border-collapse: collapse;'>"
|
||||
html += "<thead><tr style='background-color: #f5f5f5;'>"
|
||||
html += "<th style='padding: 8px; border: 1px solid #ddd; text-align: left;'>Vorgabe</th>"
|
||||
html += "<th style='padding: 8px; border: 1px solid #ddd; text-align: left;'>Titel</th>"
|
||||
html += "<th style='padding: 8px; border: 1px solid #ddd; text-align: left;'>Dokument</th>"
|
||||
html += "</tr></thead>"
|
||||
html += "<tbody>"
|
||||
|
||||
for vorgabe in vorgaben_list:
|
||||
html += "<tr>"
|
||||
html += f"<td style='padding: 6px; border: 1px solid #ddd;'>{vorgabe.Vorgabennummer()}</td>"
|
||||
html += f"<td style='padding: 6px; border: 1px solid #ddd;'>{vorgabe.titel}</td>"
|
||||
html += f"<td style='padding: 6px; border: 1px solid #ddd;'>{vorgabe.dokument.nummer} – {vorgabe.dokument.name}</td>"
|
||||
html += "</tr>"
|
||||
|
||||
html += "</tbody></table>"
|
||||
html += f"</div><p><strong>Gesamt: {count} Vorgabe{'n' if count != 1 else ''}</strong></p>"
|
||||
|
||||
return format_html(html)
|
||||
vorgaben_list.short_description = "Zugeordnete Vorgaben"
|
||||
|
||||
def get_queryset(self, request):
|
||||
"""Optimize queryset with related data"""
|
||||
return super().get_queryset(request).prefetch_related('vorgabe_set')
|
||||
|
||||
@admin.register(Person)
|
||||
class PersonAdmin(admin.ModelAdmin):
|
||||
|
||||
@@ -31,6 +31,6 @@
|
||||
<div class="flex-fill">{% block content %}Main Content{% endblock %}</div>
|
||||
<div class="col-md-2">{% block sidebar_right %}{% endblock %}</div>
|
||||
</div>
|
||||
<div>VorgabenUI v0.942</div>
|
||||
<div>VorgabenUI v0.945</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Simple script to test Vorgaben sanity checking
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import django
|
||||
|
||||
# Setup Django
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'VorgabenUI.settings')
|
||||
django.setup()
|
||||
|
||||
from dokumente.utils import check_vorgabe_conflicts, format_conflict_report
|
||||
|
||||
|
||||
def main():
|
||||
print("Running Vorgaben sanity check...")
|
||||
print("=" * 50)
|
||||
|
||||
# Check for conflicts
|
||||
conflicts = check_vorgabe_conflicts()
|
||||
|
||||
# Generate and display report
|
||||
report = format_conflict_report(conflicts, verbose=True)
|
||||
print(report)
|
||||
|
||||
print("=" * 50)
|
||||
|
||||
if conflicts:
|
||||
print(f"\n⚠️ Found {len(conflicts)} conflicts that need attention!")
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("✅ All Vorgaben are valid!")
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user