@@ -56,7 +56,7 @@ class CustomObjectTypeTable(NetBoxTable):
5656 verbose_name = _ ('Comments' ),
5757 )
5858 tags = columns .TagColumn (
59- url_name = 'circuits:provider_list '
59+ url_name = 'plugins:netbox_custom_objects:customobjecttype_list '
6060 )
6161 name = tables .Column (
6262 verbose_name = _ ('Name' ),
@@ -87,6 +87,36 @@ class Meta(NetBoxTable.Meta):
8787 )
8888
8989
90+ class CustomObjectTagColumn (columns .TagColumn ):
91+ """
92+ Custom TagColumn that generates tag filter URLs with the custom_object_type slug.
93+ """
94+ template_code = """
95+ {% load helpers %}
96+ {% for tag in value.all %}
97+ <a href="{% url 'plugins:netbox_custom_objects:customobject_list'
98+ custom_object_type=record.custom_object_type.slug %}?tag={{ tag.slug }}">
99+ <span {% if tag.description %}title="{{ tag.description }}"{% endif %}
100+ class="badge"
101+ style="color: {{ tag.color|fgcolor }}; background-color: #{{ tag.color }}">
102+ {{ tag }}
103+ </span>
104+ </a>
105+ {% empty %}
106+ <span class="text-muted">—</span>
107+ {% endfor %}
108+ """
109+
110+ def __init__ (self ):
111+ # Override parent __init__ to use our custom template
112+ tables .TemplateColumn .__init__ (
113+ self ,
114+ orderable = False ,
115+ template_code = self .template_code ,
116+ verbose_name = _ ('Tags' ),
117+ )
118+
119+
90120class CustomObjectActionsColumn (columns .ActionsColumn ):
91121
92122 def render (self , record , table , ** kwargs ):
@@ -178,6 +208,7 @@ class CustomObjectTable(NetBoxTable):
178208 actions = CustomObjectActionsColumn (
179209 actions = ('edit' , 'delete' ),
180210 )
211+ tags = CustomObjectTagColumn ()
181212
182213 class Meta (NetBoxTable .Meta ):
183214 model = CustomObject
@@ -188,6 +219,7 @@ class Meta(NetBoxTable.Meta):
188219 "custom_object_type" ,
189220 "created" ,
190221 "last_updated" ,
222+ "tags" ,
191223 )
192224 default_columns = (
193225 "pk" ,
0 commit comments