From 3b4bb51925e70b02f96810ddbc8909d462428113 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Mon, 17 May 2021 13:20:18 +0200 Subject: [PATCH] Fix display format on SaaS & Sever admin list mark_safe generated HTML --- orchestra/contrib/orchestration/admin.py | 4 ++-- orchestra/contrib/saas/admin.py | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/orchestra/contrib/orchestration/admin.py b/orchestra/contrib/orchestration/admin.py index 60737d09..a5ddcb08 100644 --- a/orchestra/contrib/orchestration/admin.py +++ b/orchestra/contrib/orchestration/admin.py @@ -179,12 +179,12 @@ class ServerAdmin(ExtendedModelAdmin): change_view_actions = actions def display_ping(self, instance): - return self._remote_state[instance.pk][0] + return mark_safe(self._remote_state[instance.pk][0]) display_ping.short_description = _("Ping") display_ping.allow_tags = True def display_uptime(self, instance): - return self._remote_state[instance.pk][1] + return mark_safe(self._remote_state[instance.pk][1]) display_uptime.short_description = _("Uptime") display_uptime.allow_tags = True diff --git a/orchestra/contrib/saas/admin.py b/orchestra/contrib/saas/admin.py index b3b0739a..1d34dfad 100644 --- a/orchestra/contrib/saas/admin.py +++ b/orchestra/contrib/saas/admin.py @@ -1,5 +1,6 @@ from django.contrib import admin from django.core.exceptions import ObjectDoesNotExist +from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ from orchestra.admin import ExtendedModelAdmin, ChangePasswordAdminMixin @@ -26,7 +27,8 @@ class SaaSAdmin(SelectPluginAdminMixin, ChangePasswordAdminMixin, AccountAdminMi plugin_field = 'service' plugin_title = 'Software as a Service' actions = (disable, enable, list_accounts) - + + @mark_safe def display_url(self, saas): site_domain = saas.get_site_domain() site_link = '%s' % (site_domain, site_domain) @@ -48,7 +50,7 @@ class SaaSAdmin(SelectPluginAdminMixin, ChangePasswordAdminMixin, AccountAdminMi display_url.short_description = _("URL") display_url.allow_tags = True display_url.admin_order_field = 'name' - + def get_fields(self, *args, **kwargs): fields = super(SaaSAdmin, self).get_fields(*args, **kwargs) if not self.plugin_instance.allow_custom_url: