|
@ -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() |
|
|