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
10 changes: 7 additions & 3 deletions netbox/netbox/views/generic/object_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,14 @@ def _get_dependent_objects(self, obj):

# Compile a mapping of models to instances
dependent_objects = defaultdict(list)
for model, instance in collector.instances_with_model():
for model, instances in collector.instances_with_model():
# Ignore relations to auto-created models (e.g. many-to-many mappings)
if model._meta.auto_created:
continue
# Omit the root object
if instance != obj:
dependent_objects[model].append(instance)
if instances == obj:
continue
dependent_objects[model].append(instances)

return dict(dependent_objects)

Expand Down