Added list of Vorgaben to Referenz-Admin
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 3m6s
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 7s
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 3m6s
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 7s
This commit is contained in:
@@ -25,7 +25,7 @@ spec:
|
||||
mountPath: /data
|
||||
containers:
|
||||
- name: web
|
||||
image: git.baumann.gr/adebaumann/vui:0.950-oblique
|
||||
image: git.baumann.gr/adebaumann/vui:0.951-oblique
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
|
||||
@@ -294,6 +294,5 @@ class VorgabeAdmin(NestedModelAdmin):
|
||||
admin.site.register(Checklistenfrage)
|
||||
admin.site.register(Dokumententyp)
|
||||
#admin.site.register(Person)
|
||||
#admin.site.register(Referenz, DraggableM§PTTAdmin)
|
||||
|
||||
#admin.site.register(Changelog)
|
||||
|
||||
@@ -180,7 +180,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-sm-6 text-right">
|
||||
<p class="text-muted">Version {{ version|default:"0.950" }}</p>
|
||||
<p class="text-muted">Version {{ version|default:"0.951" }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from django.contrib import admin
|
||||
from django.utils.html import format_html
|
||||
from nested_admin import NestedStackedInline, NestedModelAdmin, NestedTabularInline
|
||||
from .models import *
|
||||
|
||||
@@ -11,6 +12,50 @@ class ReferenzerklaerungInline(NestedStackedInline):
|
||||
|
||||
@admin.register(Referenz)
|
||||
class ReferenzAdmin(NestedModelAdmin):
|
||||
list_display = ('Path', 'vorgaben_count')
|
||||
inlines=[ReferenzerklaerungInline]
|
||||
list_display =['Path']
|
||||
search_fields=("referenz","path")
|
||||
search_fields=("name_nummer","Path")
|
||||
readonly_fields=("vorgaben_list",)
|
||||
fieldsets = (
|
||||
(None, {
|
||||
'fields': ('name_nummer','name_text','oberreferenz','url', '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.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"
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
# Admin in dokumente/admin.py
|
||||
|
||||
Reference in New Issue
Block a user