From 40d66832867ca3fd91013c86f34a2fd4e2e06dd3 Mon Sep 17 00:00:00 2001 From: DonHaul Date: Mon, 26 Aug 2024 16:59:07 +0200 Subject: [PATCH] backoffice: decision added to workflow admin view * ref: https://github.com/cern-sis/issues-inspire/issues/549 --- backoffice/backoffice/workflows/admin.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/backoffice/backoffice/workflows/admin.py b/backoffice/backoffice/workflows/admin.py index 3aa26827..bc5c3d64 100644 --- a/backoffice/backoffice/workflows/admin.py +++ b/backoffice/backoffice/workflows/admin.py @@ -63,6 +63,21 @@ def has_delete_permission(self, request, obj=None): } +class WorkflowsDecisionsInline(admin.StackedInline): + model = Decision + extra = 0 + can_delete = False + show_change_link = True + readonly_fields = ["action_value", "_updated_at", "user"] + + def has_change_permission(self, request, obj=None): + return False + + @admin.display(description="action") + def action_value(self, obj): + return obj.action + + @admin.register(Workflow) class WorkflowAdmin(BaseModelAdmin): """ @@ -89,6 +104,8 @@ class WorkflowAdmin(BaseModelAdmin): "_updated_at", ] + inlines = [WorkflowsDecisionsInline] + @admin.register(Decision) class DecisionAdmin(BaseModelAdmin):