Browse Source

A bit nicer admin UI for checks

pull/7/head
Pēteris Caune 9 years ago
parent
commit
c21b6b699b
2 changed files with 13 additions and 1 deletions
  1. +10
    -1
      hc/api/admin.py
  2. +3
    -0
      static/css/admin/checks.css

+ 10
- 1
hc/api/admin.py View File

@ -5,9 +5,18 @@ from hc.api.models import Check
@admin.register(Check) @admin.register(Check)
class ChecksAdmin(admin.ModelAdmin): class ChecksAdmin(admin.ModelAdmin):
list_display = ("id", "code", "user", "last_ping")
class Media:
css = {
'all': ('css/admin/checks.css',)
}
list_display = ("id", "name", "created", "code", "status", "email", "last_ping")
list_select_related = ("user", )
actions = ["send_alert"] actions = ["send_alert"]
def email(self, obj):
return obj.user.email if obj.user else None
def send_alert(self, request, qs): def send_alert(self, request, qs):
for check in qs: for check in qs:
check.send_alert() check.send_alert()


+ 3
- 0
static/css/admin/checks.css View File

@ -0,0 +1,3 @@
.field-code {
font-family: monospace;
}

Loading…
Cancel
Save