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

Commit

Permalink
Merge pull request #59 from kpn/feature/team-admin-slug
Browse files Browse the repository at this point in the history
Feature/team admin slug
  • Loading branch information
mjholtkamp authored Nov 26, 2019
2 parents a9359f1 + ac33070 commit e9c16b7
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions katka/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,19 @@
)


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)


@admin.register(Team)
class TeamAdmin(WithUsernameAdminModel):
fields = ("name", "group")
fields = ("name", "slug", "group")


@admin.register(Project)
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 e9c16b7

Please sign in to comment.