Skip to content

Commit 013e41b

Browse files
committed
remove generating models
1 parent ef54f1c commit 013e41b

File tree

1 file changed

+0
-21
lines changed

1 file changed

+0
-21
lines changed

netbox_custom_objects/models.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -328,27 +328,6 @@ def _fetch_and_generate_field_attrs(
328328
field_type = FIELD_TYPE_CLASS[field.type]()
329329
field_name = field.name
330330

331-
# Check if we're in a recursion situation before generating the field
332-
# Use depth-based recursion control: allow self-referential fields at level 0, skip at deeper levels
333-
should_skip = False
334-
335-
if field.type in [CustomFieldTypeChoices.TYPE_OBJECT, CustomFieldTypeChoices.TYPE_MULTIOBJECT]:
336-
if field.related_object_type:
337-
# Check if this field references the same CustomObjectType (self-referential)
338-
if field.related_object_type.app_label == APP_LABEL:
339-
# This is a custom object type
340-
from django.contrib.contenttypes.models import ContentType
341-
content_type = ContentType.objects.get(pk=field.related_object_type_id)
342-
if content_type.app_label == APP_LABEL:
343-
# Extract the custom object type ID from the model name
344-
# The model name format is "table{id}model" or similar
345-
model_name = content_type.model
346-
347-
# Try to extract the ID from the model name
348-
id_match = re.search(r'table(\d+)model', model_name, re.IGNORECASE)
349-
if id_match:
350-
custom_object_type_id = int(id_match.group(1))
351-
352331
field_attrs[field.name] = field_type.get_model_field(
353332
field,
354333
)

0 commit comments

Comments
 (0)