Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions netbox_custom_objects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ class CustomObjectsPluginConfig(PluginConfig):
name = "netbox_custom_objects"
verbose_name = "Custom Objects"
description = "A plugin to manage custom objects in NetBox"
version = "0.1.0"
version = "0.2.0"
base_url = "custom-objects"
min_version = "4.2.0"
min_version = "4.4.0"
default_settings = {}
required_settings = []
template_extensions = "template_content.template_extensions"
Expand Down
46 changes: 12 additions & 34 deletions netbox_custom_objects/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import re
# Generated by Django 5.2.5 on 2025-08-18 17:15

import django.core.validators
import django.db.models.deletion
import django.db.models.functions.text
import netbox_custom_objects.models
import netbox.models.deletion
import re
import taggit.managers
import utilities.json
import utilities.validators
Expand All @@ -15,8 +16,8 @@ class Migration(migrations.Migration):
initial = True

dependencies = [
('core', '0012_job_object_type_optional'),
('extras', '0123_journalentry_kind_default'),
("core", "0018_concrete_objecttype"),
("extras", "0132_configcontextprofile"),
]

operations = [
Expand All @@ -28,33 +29,7 @@ class Migration(migrations.Migration):
"indexes": [],
"constraints": [],
},
bases=("contenttypes.contenttype",),
managers=[
(
"objects",
netbox_custom_objects.models.CustomObjectObjectTypeManager(),
),
],
),
migrations.CreateModel(
name="CustomObject",
fields=[
(
"id",
models.BigAutoField(
auto_created=True, primary_key=True, serialize=False
),
),
(
"tags",
taggit.managers.TaggableManager(
through="extras.TaggedItem", to="extras.Tag"
),
),
],
options={
"abstract": False,
},
bases=("core.objecttype",),
),
migrations.CreateModel(
name="CustomObjectType",
Expand All @@ -75,8 +50,9 @@ class Migration(migrations.Migration):
encoder=utilities.json.CustomFieldJSONEncoder,
),
),
("description", models.CharField(blank=True, max_length=200)),
("comments", models.TextField(blank=True)),
("name", models.CharField(max_length=100, unique=True)),
("description", models.TextField(blank=True)),
("schema", models.JSONField(blank=True, default=dict)),
("verbose_name_plural", models.CharField(blank=True, max_length=100)),
(
Expand All @@ -90,6 +66,7 @@ class Migration(migrations.Migration):
"verbose_name": "Custom Object Type",
"ordering": ("name",),
},
bases=(netbox.models.deletion.DeleteMixin, models.Model),
),
migrations.CreateModel(
name="CustomObjectTypeField",
Expand Down Expand Up @@ -117,7 +94,7 @@ class Migration(migrations.Migration):
django.core.validators.RegexValidator(
flags=re.RegexFlag["IGNORECASE"],
inverse_match=True,
message="Double underscores are not permitted in custom field names.",
message="Double underscores are not permitted in custom object field names.",
regex="__",
),
],
Expand All @@ -128,7 +105,7 @@ class Migration(migrations.Migration):
("description", models.CharField(blank=True, max_length=200)),
("required", models.BooleanField(default=False)),
("unique", models.BooleanField(default=False)),
("search_weight", models.PositiveSmallIntegerField(default=1000)),
("search_weight", models.PositiveSmallIntegerField(default=500)),
("filter_logic", models.CharField(default="loose", max_length=50)),
("default", models.JSONField(blank=True, null=True)),
("related_object_filter", models.JSONField(blank=True, null=True)),
Expand Down Expand Up @@ -180,6 +157,7 @@ class Migration(migrations.Migration):
"verbose_name_plural": "custom object type fields",
"ordering": ["group_name", "weight", "name"],
},
bases=(netbox.models.deletion.DeleteMixin, models.Model),
),
migrations.AddConstraint(
model_name="customobjecttype",
Expand Down

This file was deleted.

19 changes: 0 additions & 19 deletions netbox_custom_objects/migrations/0003_delete_customobject.py

This file was deleted.

18 changes: 0 additions & 18 deletions netbox_custom_objects/migrations/0004_customobjecttype_comments.py

This file was deleted.

This file was deleted.

This file was deleted.

7 changes: 4 additions & 3 deletions netbox_custom_objects/navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ def __iter__(self):

current_version = version.parse(settings.RELEASE.version)

groups = [(_("Object Types"), (custom_object_type_plugin_menu_item,))]
if current_version >= version.parse("4.3.4"):
groups.append((_("Objects"), CustomObjectTypeMenuItems()))
groups = [
(_("Object Types"), (custom_object_type_plugin_menu_item,)),
(_("Objects"), CustomObjectTypeMenuItems()),
]

menu = PluginMenu(
label=_("Custom Objects"),
Expand Down