django admin添加一列链接
def topo(self, obj):
#return mark_safe(f'<a href="http://192.168.182.143:8000/gragh/?resource_property_value=park1&resource_type=%E5%9B%AD%E5%8C%BA&resource_property=park_id">查看</a>')
return mark_safe(f'<a href="http://192.168.202.192:8911/graghtwo?resourceType={obj.alarm_object_type}&resourceId={obj.alarm_object_id}">查看</a>')
topo.short_description = '资源拓扑'
topo.allow_tags = True
# readonly_fields = ('alarm_id',)
# 列表展示的字段
list_display = (
'topo',)