Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1ea9c5c
Merge pull request #159 from netboxlabs/feature
bctiemann Aug 18, 2025
79ad9c6
161 fix multi object field
arthanson Aug 19, 2025
a841e1d
161 fix multi object field
arthanson Aug 19, 2025
b5d2d03
Merge pull request #162 from netboxlabs/161-multi-object-3
bctiemann Aug 19, 2025
0f477a4
Check if unique flag raise validation error if non unique data
arthanson Aug 19, 2025
c111f86
NPL-411 raise validation error if using reserved names for fields
arthanson Aug 19, 2025
962de13
Merge pull request #163 from netboxlabs/npl-389-unique
bctiemann Aug 20, 2025
8abaefa
Merge pull request #164 from netboxlabs/NPL-411-reserved-names
bctiemann Aug 20, 2025
1f0197b
Revert "Check if unique flag raise validation error if non unique data"
bctiemann Aug 20, 2025
1bc72cd
Update docs for 0.2.0
mrmrcoleman Aug 20, 2025
1178246
Merge pull request #167 from netboxlabs/revert-163-npl-389-unique
bctiemann Aug 20, 2025
91335ba
NPL-389 fix unique check
arthanson Aug 20, 2025
636d67d
Merge pull request #168 from netboxlabs/0.2.0-docs
mrmrcoleman Aug 20, 2025
a850a9c
Merge pull request #170 from netboxlabs/npl-389-unique-3
bctiemann Aug 20, 2025
b311f7b
Bump version to 0.2.0 in pyproject.toml
bctiemann Aug 20, 2025
34fb653
174 fix delete of CO on detail page
arthanson Aug 20, 2025
3216a93
174 fix delete of CO on detail page
arthanson Aug 20, 2025
1cf0c80
Merge pull request #175 from netboxlabs/174-delete
bctiemann Aug 20, 2025
f2e2da1
Merge pull request #173 from netboxlabs/bump-pyproject-version
bctiemann Aug 20, 2025
7965692
Add verbose_name and slug fields with help text
bctiemann Aug 21, 2025
80c9110
Change all uses of custom_object_type.name to use slug in urls or ver…
bctiemann Aug 22, 2025
5c0e7e8
Fix tests
bctiemann Aug 22, 2025
cbeff30
Merge branch 'feature' into verbose-plural-name-slug
bctiemann Aug 22, 2025
fdb3dd8
Add new COT fields to serializer
bctiemann Aug 22, 2025
700af72
Merge branch 'feature' into verbose-plural-name-slug
bctiemann Aug 22, 2025
aa38672
Make slug non-nullable and remake migrations
bctiemann Aug 22, 2025
1c8be45
Add CustomObjectType.name validation
bctiemann Aug 22, 2025
f991386
Clean up display_name
bctiemann Aug 22, 2025
b523424
Fix tests
bctiemann Aug 22, 2025
628528a
Merge branch 'feature' into verbose-plural-name-slug
bctiemann Aug 25, 2025
4311869
Replace custom_object_type.name with custom_object_type.slug in sever…
bctiemann Aug 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion netbox_custom_objects/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion netbox_custom_objects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this one is correct

{% if object.slug %}({{ object.slug }}){% endif %}
{% endblock object_identifier %}

Expand Down Expand Up @@ -74,10 +74,10 @@
<a class="nav-link{% if not tab %} active{% endif %}" href="{{ object.get_absolute_url }}">{{ object.custom_object_type.get_verbose_name }}</a>
</li>
<li class="nav-item">
<a class="nav-link{% if tab == 'journal' %} active{% endif %}" href="{% url 'plugins:netbox_custom_objects:customobject_journal' object.custom_object_type.name object.pk %}">{% trans "Journal" %}</a>
<a class="nav-link{% if tab == 'journal' %} active{% endif %}" href="{% url 'plugins:netbox_custom_objects:customobject_journal' object.custom_object_type.slug object.pk %}">{% trans "Journal" %}</a>
</li>
<li class="nav-item">
<a class="nav-link{% if tab == 'changelog' %} active{% endif %}" href="{% url 'plugins:netbox_custom_objects:customobject_changelog' object.custom_object_type.name object.pk %}">{% trans "Changelog" %}</a>
<a class="nav-link{% if tab == 'changelog' %} active{% endif %}" href="{% url 'plugins:netbox_custom_objects:customobject_changelog' object.custom_object_type.slug object.pk %}">{% trans "Changelog" %}</a>
</li>
</ul>
{% endblock tabs %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions netbox_custom_objects/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
)
Expand All @@ -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,
},
)
Expand Down Expand Up @@ -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")
Expand Down