From 63b10b40ce585ddbf04161730294bca6ec0a4a92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Mon, 1 Aug 2016 16:28:38 +0300 Subject: [PATCH] Limit "value" column width in channel admin --- hc/api/admin.py | 9 ++++++--- static/css/admin/channels.css | 7 +++++++ 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 static/css/admin/channels.css diff --git a/hc/api/admin.py b/hc/api/admin.py index ee9b3763..e9e5a031 100644 --- a/hc/api/admin.py +++ b/hc/api/admin.py @@ -24,7 +24,7 @@ class ChecksAdmin(admin.ModelAdmin): class Media: css = { - 'all': ('css/admin/checks.css',) + 'all': ('css/admin/checks.css',) } search_fields = ["name", "user__email", "code"] @@ -34,7 +34,6 @@ class ChecksAdmin(admin.ModelAdmin): list_filter = ("status", OwnershipListFilter, "last_ping") actions = ["send_alert"] - def email(self, obj): return obj.user.email if obj.user else None @@ -44,7 +43,6 @@ class ChecksAdmin(admin.ModelAdmin): return "%s [%s]" % (obj.name, obj.tags) - def send_alert(self, request, qs): for check in qs: check.send_alert() @@ -141,6 +139,11 @@ class PingsAdmin(admin.ModelAdmin): @admin.register(Channel) class ChannelsAdmin(admin.ModelAdmin): + class Media: + css = { + 'all': ('css/admin/channels.css',) + } + search_fields = ["value", "user__email"] list_select_related = ("user", ) list_display = ("id", "code", "email", "formatted_kind", "value", diff --git a/static/css/admin/channels.css b/static/css/admin/channels.css new file mode 100644 index 00000000..093bd503 --- /dev/null +++ b/static/css/admin/channels.css @@ -0,0 +1,7 @@ +.field-value { + max-width: 400px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + +} \ No newline at end of file