1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #8302: Linkify role column in device & VM tables

This commit is contained in:
jeremystretch
2022-01-10 09:48:14 -05:00
parent 02519b270e
commit 076ca46ab4
6 changed files with 17 additions and 12 deletions

View File

@@ -330,15 +330,15 @@ class ColoredLabelColumn(tables.TemplateColumn):
Render a colored label (e.g. for DeviceRoles).
"""
template_code = """
{% load helpers %}
{% if value %}
<span class="badge" style="color: {{ value.color|fgcolor }}; background-color: #{{ value.color }}">
{{ value }}
</span>
{% else %}
&mdash;
{% endif %}
"""
{% load helpers %}
{% if value %}
<span class="badge" style="color: {{ value.color|fgcolor }}; background-color: #{{ value.color }}">
<a href="{{ value.get_absolute_url }}">{{ value }}</a>
</span>
{% else %}
&mdash;
{% endif %}
"""
def __init__(self, *args, **kwargs):
super().__init__(template_code=self.template_code, *args, **kwargs)