Skip to content
This repository has been archived by the owner on May 15, 2020. It is now read-only.

Commit

Permalink
OPT: Show some 'created_at' fields because they are used for sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
Michiel Holtkamp committed Nov 26, 2019
1 parent e2f6f68 commit ac33070
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions katka/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -69,15 +73,15 @@ 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",)


@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",)

Expand All @@ -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",)

0 comments on commit ac33070

Please sign in to comment.