File tree Expand file tree Collapse file tree
netbox_custom_objects_tab/views Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -418,16 +418,21 @@ def register_typed_tabs(model_classes, weight):
418418 ]
419419
420420 # Non-polymorphic fields: single related_object_type FK.
421+ # is_polymorphic=False keeps this queryset disjoint from poly_fields
422+ # below — a field row with both attrs set (legacy misconfig:
423+ # is_polymorphic is immutable upstream but related_object_type isn't
424+ # nulled when toggled) would otherwise hit both querysets. _record's
425+ # seen_field_keys stays as defence in depth.
421426 non_poly_fields = list (
422427 CustomObjectTypeField .objects .filter (
428+ is_polymorphic = False ,
423429 type__in = type_choices ,
424430 ).select_related ("custom_object_type" )
425431 )
426432
427433 # Polymorphic fields: related_object_types M2M (one field → many target CTs).
428434 # Fetched as a separate queryset so we can iterate prefetched M2M targets
429- # without an extra query per field. Both lists may overlap by PK only if
430- # a field has both attrs set — that's a misconfiguration; we de-dup below.
435+ # without an extra query per field.
431436 poly_fields = list (
432437 CustomObjectTypeField .objects .filter (
433438 is_polymorphic = True ,
You can’t perform that action at this time.
0 commit comments