From e2f6f68430e03df5790b6a18dcae53a68dc57cf7 Mon Sep 17 00:00:00 2001 From: Michiel Holtkamp Date: Tue, 26 Nov 2019 14:39:54 +0100 Subject: [PATCH 1/2] OPT: Allow slug in team admin to be edited --- katka/admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/katka/admin.py b/katka/admin.py index 0209a54..331b1da 100644 --- a/katka/admin.py +++ b/katka/admin.py @@ -24,7 +24,7 @@ def save_model(self, request, obj, form, change): @admin.register(Team) class TeamAdmin(WithUsernameAdminModel): - fields = ("name", "group") + fields = ("name", "slug", "group") @admin.register(Project) From ac330707b3300f8713c93acf936304c578218944 Mon Sep 17 00:00:00 2001 From: Michiel Holtkamp Date: Tue, 26 Nov 2019 14:40:45 +0100 Subject: [PATCH 2/2] OPT: Show some 'created_at' fields because they are used for sorting --- katka/admin.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/katka/admin.py b/katka/admin.py index 331b1da..6c085d8 100644 --- a/katka/admin.py +++ b/katka/admin.py @@ -16,7 +16,11 @@ ) -class WithUsernameAdminModel(admin.ModelAdmin): +class ReadOnlyAuditFieldsMixin: + readonly_fields = ("created_at", "created_username", "modified_at", "modified_username", "deleted") + + +class WithUsernameAdminModel(admin.ModelAdmin, ReadOnlyAuditFieldsMixin): def save_model(self, request, obj, form, change): with username_on_model(self.model, request.user.username): super().save_model(request, obj, form, change) @@ -69,7 +73,7 @@ class SCMPipelineRunAdmin(WithUsernameAdminModel): "pipeline_yaml", "application", ) - list_display = ("pk", "application", "commit_hash", "first_parent_hash") + list_display = ("pk", "application", "commit_hash", "first_parent_hash", "created_at") list_filter = ("application__name",) ordering = ("created_at",) @@ -77,7 +81,7 @@ class SCMPipelineRunAdmin(WithUsernameAdminModel): @admin.register(SCMStepRun) class SCMStepRunAdmin(WithUsernameAdminModel): fields = ("slug", "name", "stage", "status", "output", "started_at", "ended_at", "scm_pipeline_run") - list_display = ("pk", "scm_pipeline_run", "name", "stage", "status", "started_at", "ended_at") + list_display = ("pk", "scm_pipeline_run", "name", "stage", "status", "created_at", "started_at", "ended_at") list_filter = ("scm_pipeline_run__application__name",) ordering = ("created_at",) @@ -91,5 +95,5 @@ class ApplicationMetadataAdmin(WithUsernameAdminModel): @admin.register(SCMRelease) class SCMReleaseAdmin(WithUsernameAdminModel): fields = ("name", "status", "started_at", "ended_at", "scm_pipeline_runs") - list_display = ("pk", "name") + list_display = ("pk", "name", "status", "created_at", "started_at", "ended_at") ordering = ("created_at",)