From c21b6b699b443363ebffb62cd64aca86961c0c91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Sat, 11 Jul 2015 13:58:15 +0300 Subject: [PATCH] A bit nicer admin UI for checks --- hc/api/admin.py | 11 ++++++++++- static/css/admin/checks.css | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 static/css/admin/checks.css diff --git a/hc/api/admin.py b/hc/api/admin.py index 00f77a7d..e7c3294f 100644 --- a/hc/api/admin.py +++ b/hc/api/admin.py @@ -5,9 +5,18 @@ from hc.api.models import Check @admin.register(Check) 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"] + def email(self, obj): + return obj.user.email if obj.user else None + def send_alert(self, request, qs): for check in qs: check.send_alert() diff --git a/static/css/admin/checks.css b/static/css/admin/checks.css new file mode 100644 index 00000000..e91d22ff --- /dev/null +++ b/static/css/admin/checks.css @@ -0,0 +1,3 @@ +.field-code { + font-family: monospace; +} \ No newline at end of file