1.
horizon\tables\base.py
class Column(html.HTMLElement):
def get_link_url(self, datum):
obj_id = self.table.get_object_id(datum)
if callable(self.link):
return self.link(datum)
try:
return urlresolvers.reverse(self.link, args=(obj_id,)) 注: obj_id 修改为datum.name即可,不过这样修改涉及到所有的列表页面,可以根据url判断,如2
except urlresolvers.NoReverseMatch:
return self.link
2.
obj_id = self.table.get_object_id(datum)
"""
LOG.error("-------------------------get_link_url")
obj_name=self.table.get_object_display(datum)
host_name = datum.host_name
LOG.error("--------------------------get_link_url end")
"""
"""
request_uri = self._meta.request.META.get('REQUEST_URI')
LOG.error(request_uri)
flag = request_uri.find('syspanel/hosts') != -1
if flag:
return urlresolvers.reverse(self.link, args=(host_name,))
"""
if callable(self.link):
return self.link(datum)
try:
return urlresolvers.reverse(self.link, args=(obj_id,))
except urlresolvers.NoReverseMatch:
return self.link