Skip to content
Merged
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: 4 additions & 0 deletions netbox_custom_objects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,7 @@ def _has_circular_reference(self, custom_object_type, visited):
visited.add(custom_object_type.id)

# Check all object and multiobject fields in this custom object type
related_objects_checked = set()
for field in custom_object_type.fields.filter(
type__in=[
CustomFieldTypeChoices.TYPE_OBJECT,
Expand All @@ -1079,6 +1080,9 @@ def _has_circular_reference(self, custom_object_type, visited):
related_object_type__isnull=False,
related_object_type__app_label=APP_LABEL
):
if field.related_object_type in related_objects_checked:
continue
related_objects_checked.add(field.related_object_type)

# Get the related custom object type directly from the object_type relationship
try:
Expand Down