diff --git a/netbox_custom_objects/tables.py b/netbox_custom_objects/tables.py
index 58f1d6a..935c52d 100644
--- a/netbox_custom_objects/tables.py
+++ b/netbox_custom_objects/tables.py
@@ -56,7 +56,7 @@ class CustomObjectTypeTable(NetBoxTable):
verbose_name=_('Comments'),
)
tags = columns.TagColumn(
- url_name='circuits:provider_list'
+ url_name='plugins:netbox_custom_objects:customobjecttype_list'
)
name = tables.Column(
verbose_name=_('Name'),
@@ -87,6 +87,36 @@ class Meta(NetBoxTable.Meta):
)
+class CustomObjectTagColumn(columns.TagColumn):
+ """
+ Custom TagColumn that generates tag filter URLs with the custom_object_type slug.
+ """
+ template_code = """
+ {% load helpers %}
+ {% for tag in value.all %}
+
+
+ {{ tag }}
+
+
+ {% empty %}
+ —
+ {% endfor %}
+ """
+
+ def __init__(self):
+ # Override parent __init__ to use our custom template
+ tables.TemplateColumn.__init__(
+ self,
+ orderable=False,
+ template_code=self.template_code,
+ verbose_name=_('Tags'),
+ )
+
+
class CustomObjectActionsColumn(columns.ActionsColumn):
def render(self, record, table, **kwargs):
@@ -178,6 +208,7 @@ class CustomObjectTable(NetBoxTable):
actions = CustomObjectActionsColumn(
actions=('edit', 'delete'),
)
+ tags = CustomObjectTagColumn()
class Meta(NetBoxTable.Meta):
model = CustomObject
@@ -188,6 +219,7 @@ class Meta(NetBoxTable.Meta):
"custom_object_type",
"created",
"last_updated",
+ "tags",
)
default_columns = (
"pk",
diff --git a/netbox_custom_objects/views.py b/netbox_custom_objects/views.py
index e7e261a..74faa57 100644
--- a/netbox_custom_objects/views.py
+++ b/netbox_custom_objects/views.py
@@ -20,6 +20,7 @@
from netbox.views import generic
from netbox.views.generic.mixins import TableMixin
from utilities.forms import ConfirmationForm
+from utilities.forms.fields import TagFilterField
from utilities.htmx import htmx_partial
from utilities.views import ConditionalLoginRequiredMixin, ViewTab, get_viewname, register_model_view
@@ -345,6 +346,7 @@ def get_filterset_form(self):
attrs = {
"model": model,
"__module__": "database.filterset_forms",
+ "tag": TagFilterField(model),
}
for field in self.custom_object_type.fields.all():