Skip to content

Commit 69ea1cd

Browse files
network-scriptsKani999
authored andcommitted
Guard combined-tab discovery against polymorphic/non-poly double-yield
1 parent 02df977 commit 69ea1cd

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

netbox_custom_objects_tab/views/combined.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,13 @@ def _iter_linked_fields(instance):
5656
content_type = ContentType.objects.get_for_model(instance._meta.model)
5757
type_choices = [CustomFieldTypeChoices.TYPE_OBJECT, CustomFieldTypeChoices.TYPE_MULTIOBJECT]
5858

59+
# is_polymorphic=False keeps the two querysets disjoint — a row with
60+
# related_object_type set AND is_polymorphic=True (a legacy misconfig:
61+
# is_polymorphic is immutable upstream but related_object_type isn't
62+
# nulled when toggled) would otherwise be yielded twice.
5963
non_poly = CustomObjectTypeField.objects.filter(
6064
related_object_type=content_type,
65+
is_polymorphic=False,
6166
type__in=type_choices,
6267
).select_related("custom_object_type")
6368

0 commit comments

Comments
 (0)