Skip to content

Commit 3b3692a

Browse files
authored
Remove unused schema field and squash migrations (#234)
1 parent 93fe52d commit 3b3692a

File tree

4 files changed

+11
-93
lines changed

4 files changed

+11
-93
lines changed

netbox_custom_objects/migrations/0001_initial.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated by Django 5.2.5 on 2025-08-22 18:57
1+
# Generated by Django 5.2.6 on 2025-09-18 23:56
22

33
import django.core.validators
44
import django.db.models.deletion
@@ -17,7 +17,7 @@ class Migration(migrations.Migration):
1717

1818
dependencies = [
1919
("core", "0018_concrete_objecttype"),
20-
("extras", "0132_configcontextprofile"),
20+
("extras", "0133_make_cf_minmax_decimal"),
2121
]
2222

2323
operations = [
@@ -71,16 +71,21 @@ class Migration(migrations.Migration):
7171
],
7272
),
7373
),
74-
("schema", models.JSONField(blank=True, default=dict)),
74+
("version", models.CharField(blank=True, max_length=10)),
7575
("verbose_name", models.CharField(blank=True, max_length=100)),
7676
("verbose_name_plural", models.CharField(blank=True, max_length=100)),
7777
("slug", models.SlugField(max_length=100, unique=True)),
7878
(
79-
"tags",
80-
taggit.managers.TaggableManager(
81-
through="extras.TaggedItem", to="extras.Tag"
79+
"object_type", models.OneToOneField(
80+
blank=True,
81+
editable=False,
82+
null=True,
83+
on_delete=django.db.models.deletion.CASCADE,
84+
related_name="custom_object_types",
85+
to="core.objecttype",
8286
),
8387
),
88+
("tags", taggit.managers.TaggableManager(through="extras.TaggedItem", to="extras.Tag")),
8489
],
8590
options={
8691
"verbose_name": "Custom Object Type",

netbox_custom_objects/migrations/0002_customobjecttype_version.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

netbox_custom_objects/migrations/0003_customobjecttype_object_type.py

Lines changed: 0 additions & 54 deletions
This file was deleted.

netbox_custom_objects/models.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ class CustomObjectType(PrimaryModel):
187187
),
188188
)
189189
version = models.CharField(max_length=10, blank=True)
190-
schema = models.JSONField(blank=True, default=dict)
191190
verbose_name = models.CharField(max_length=100, blank=True)
192191
verbose_name_plural = models.CharField(max_length=100, blank=True)
193192
slug = models.SlugField(max_length=100, unique=True, db_index=True)
@@ -280,20 +279,6 @@ def get_cached_through_models(cls, custom_object_type_id):
280279
"""
281280
return cls._through_model_cache.get(custom_object_type_id, {})
282281

283-
@property
284-
def formatted_schema(self):
285-
result = "<ul>"
286-
for field_name, field in self.schema.items():
287-
field_type = field.get("type")
288-
if field_type in ["object", "multiobject"]:
289-
content_type = ContentType.objects.get(
290-
app_label=field["app_label"], model=field["model"]
291-
)
292-
field = content_type
293-
result += f"<li>{field_name}: {field}</li>"
294-
result += "</ul>"
295-
return result
296-
297282
def get_absolute_url(self):
298283
return reverse("plugins:netbox_custom_objects:customobjecttype", args=[self.pk])
299284

0 commit comments

Comments
 (0)