|
@ -42,7 +42,7 @@ class ChecksAdmin(admin.ModelAdmin): |
|
|
url = reverse("hc-checks", args=[obj.project.code]) |
|
|
url = reverse("hc-checks", args=[obj.project.code]) |
|
|
name = escape(obj.project_name or "Default") |
|
|
name = escape(obj.project_name or "Default") |
|
|
email = escape(obj.email) |
|
|
email = escape(obj.email) |
|
|
return f'<a href="{url}"">{name}</a> • {email}' |
|
|
|
|
|
|
|
|
return f'{email} › <a href="{url}"">{name}</a>' |
|
|
|
|
|
|
|
|
@mark_safe |
|
|
@mark_safe |
|
|
def name_tags(self, obj): |
|
|
def name_tags(self, obj): |
|
@ -177,9 +177,9 @@ class ChannelsAdmin(admin.ModelAdmin): |
|
|
search_fields = ["value", "project__owner__email"] |
|
|
search_fields = ["value", "project__owner__email"] |
|
|
list_display = ( |
|
|
list_display = ( |
|
|
"id", |
|
|
"id", |
|
|
|
|
|
"kind_", |
|
|
"name", |
|
|
"name", |
|
|
"project_", |
|
|
"project_", |
|
|
"formatted_kind", |
|
|
|
|
|
"value", |
|
|
"value", |
|
|
"num_notifications", |
|
|
"num_notifications", |
|
|
) |
|
|
) |
|
@ -191,7 +191,7 @@ class ChannelsAdmin(admin.ModelAdmin): |
|
|
url = reverse("hc-checks", args=[obj.project.code]) |
|
|
url = reverse("hc-checks", args=[obj.project.code]) |
|
|
name = escape(obj.project_name or "Default") |
|
|
name = escape(obj.project_name or "Default") |
|
|
email = escape(obj.email) |
|
|
email = escape(obj.email) |
|
|
return f"<a href='{url}'>{name}</a> • {email}" |
|
|
|
|
|
|
|
|
return f"{email} › <a href='{url}'>{name}</a>" |
|
|
|
|
|
|
|
|
def get_queryset(self, request): |
|
|
def get_queryset(self, request): |
|
|
qs = super().get_queryset(request) |
|
|
qs = super().get_queryset(request) |
|
@ -201,13 +201,8 @@ class ChannelsAdmin(admin.ModelAdmin): |
|
|
return qs |
|
|
return qs |
|
|
|
|
|
|
|
|
@mark_safe |
|
|
@mark_safe |
|
|
def formatted_kind(self, obj): |
|
|
|
|
|
if obj.kind == "email" and not obj.email_verified: |
|
|
|
|
|
return "Email <i>(unconfirmed)</i>" |
|
|
|
|
|
|
|
|
|
|
|
return obj.get_kind_display() |
|
|
|
|
|
|
|
|
|
|
|
formatted_kind.short_description = "Kind" |
|
|
|
|
|
|
|
|
def kind_(self, obj): |
|
|
|
|
|
return f'<span class="icon-{ obj.kind }"></span> {obj.kind}' |
|
|
|
|
|
|
|
|
def num_notifications(self, obj): |
|
|
def num_notifications(self, obj): |
|
|
return obj.notification__count |
|
|
return obj.notification__count |
|
|