diff --git a/netbox_custom_objects/api/views.py b/netbox_custom_objects/api/views.py
index 3745179..343c379 100644
--- a/netbox_custom_objects/api/views.py
+++ b/netbox_custom_objects/api/views.py
@@ -23,7 +23,7 @@ class CustomObjectViewSet(ModelViewSet):
def get_view_name(self):
if self.model:
- return self.model.custom_object_type.verbose_name or self.model.custom_object_type.name
+ return self.model.custom_object_type.display_name
return 'Custom Object'
def get_serializer_class(self):
diff --git a/netbox_custom_objects/models.py b/netbox_custom_objects/models.py
index 89ebe3d..ada23db 100644
--- a/netbox_custom_objects/models.py
+++ b/netbox_custom_objects/models.py
@@ -395,7 +395,7 @@ def display_name(self):
@staticmethod
def get_content_type_label(custom_object_type_id):
custom_object_type = CustomObjectType.objects.get(pk=custom_object_type_id)
- return f"Custom Objects > {custom_object_type.name}"
+ return f"Custom Objects > {custom_object_type.display_name}"
def register_custom_object_search_index(self, model):
# model must be an instance of this CustomObjectType's get_model() generated class
diff --git a/netbox_custom_objects/templates/netbox_custom_objects/customobject.html b/netbox_custom_objects/templates/netbox_custom_objects/customobject.html
index d983a5f..c06b087 100644
--- a/netbox_custom_objects/templates/netbox_custom_objects/customobject.html
+++ b/netbox_custom_objects/templates/netbox_custom_objects/customobject.html
@@ -19,7 +19,7 @@
{% endblock breadcrumbs %}
{% block object_identifier %}
-{{ object|meta:"app_label" }}.{{ object.custom_object_type.name }}:{{ object.pk }}
+{{ object|meta:"app_label" }}.{{ object.custom_object_type.slug }}:{{ object.pk }}
{% if object.slug %}({{ object.slug }}){% endif %}
{% endblock object_identifier %}
@@ -74,10 +74,10 @@
{{ object.custom_object_type.get_verbose_name }}
- {% trans "Journal" %}
+ {% trans "Journal" %}
- {% trans "Changelog" %}
+ {% trans "Changelog" %}
{% endblock tabs %}
diff --git a/netbox_custom_objects/templatetags/custom_object_buttons.py b/netbox_custom_objects/templatetags/custom_object_buttons.py
index 7dbc759..b93a9d3 100644
--- a/netbox_custom_objects/templatetags/custom_object_buttons.py
+++ b/netbox_custom_objects/templatetags/custom_object_buttons.py
@@ -207,7 +207,7 @@ def custom_object_import_button(model, custom_object_type, action="bulk_import")
try:
viewname = get_viewname(model, action)
url = reverse(
- viewname, kwargs={"custom_object_type": custom_object_type.name.lower()}
+ viewname, kwargs={"custom_object_type": custom_object_type.slug}
)
except NoReverseMatch:
url = None
diff --git a/netbox_custom_objects/views.py b/netbox_custom_objects/views.py
index 9677b77..da92092 100644
--- a/netbox_custom_objects/views.py
+++ b/netbox_custom_objects/views.py
@@ -55,7 +55,7 @@ def get_return_url(self):
return reverse(
"plugins:netbox_custom_objects:customobject_journal",
kwargs={
- "custom_object_type": self.custom_object.custom_object_type.name,
+ "custom_object_type": self.custom_object.custom_object_type.slug,
"pk": self.custom_object.pk,
},
)
@@ -81,7 +81,7 @@ def get_return_url(self, request, instance):
return reverse(
"plugins:netbox_custom_objects:customobject_journal",
kwargs={
- "custom_object_type": instance.assigned_object.custom_object_type.name,
+ "custom_object_type": instance.assigned_object.custom_object_type.slug,
"pk": instance.assigned_object.pk,
},
)
@@ -555,7 +555,7 @@ def get_return_url(self, request, obj=None):
"""
if obj:
# Get the custom object type from the object directly
- custom_object_type = obj.custom_object_type.name
+ custom_object_type = obj.custom_object_type.slug
else:
# Fallback to getting it from kwargs if object is not available
custom_object_type = self.kwargs.get("custom_object_type")