Fix display format on SaaS & Sever admin list
mark_safe generated HTML
This commit is contained in:
parent
a6c5aa32df
commit
3b4bb51925
|
@ -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
|
||||
|
||||
|
|
|
@ -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 = '<a href="http://%s">%s</a>' % (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:
|
||||
|
|
Loading…
Reference in New Issue