Wrong dependent objects when deleting contacts #7035

Closed
opened 2025-12-29 19:48:08 +01:00 by adam · 1 comment
Owner

Originally created by @dreng on GitHub (Sep 28, 2022).

Originally assigned to: @arthanson on GitHub.

NetBox version

v.3.3.4

Python version

3.9

Steps to Reproduce

  1. Open a contact that has assignments, like https://demo.netbox.dev/tenancy/contacts/3/
  2. Press delete button
  3. Notice the error box in the lower right corner that says, that the contact depends on itself.

Expected Behavior

The error box should link/list names of assigned objects.

Observed Behavior

Instead of assigned objects, the contact itself is listed as many times as number of assignments exist. In this example it is "Dwight Schrute" 2 times while it should be "vm1" and "DM-Scranton".

grafik

Originally created by @dreng on GitHub (Sep 28, 2022). Originally assigned to: @arthanson on GitHub. ### NetBox version v.3.3.4 ### Python version 3.9 ### Steps to Reproduce 1. Open a contact that has assignments, like https://demo.netbox.dev/tenancy/contacts/3/ 2. Press delete button 3. Notice the error box in the lower right corner that says, that the contact depends on itself. ### Expected Behavior The error box should link/list names of assigned objects. ### Observed Behavior Instead of assigned objects, the contact itself is listed as many times as number of assignments exist. In this example it is "Dwight Schrute" 2 times while it should be "vm1" and "DM-Scranton". ![grafik](https://user-images.githubusercontent.com/20901110/192701238-3b823d3a-e2a3-451f-b369-9a474a4ead48.png)
adam added the type: bugstatus: accepted labels 2025-12-29 19:48:08 +01:00
adam closed this issue 2025-12-29 19:48:09 +01:00
Author
Owner

@jeremystretch commented on GitHub (Sep 30, 2022):

Instead of assigned objects, the contact itself is listed as many times as number of assignments exist. In this example it is "Dwight Schrute" 2 times while it should be "vm1" and "DM-Scranton".

That's not quite what's happening. The objects listed are the assignments of this contact to an object. (They link to the contact itself because there is no UI view for an individual assignment). This behavior is expected, but could stand to be clarified, perhaps by extending the __str__() method on ContactAssignment to clearly indicate that it is an assignment of a contact to an object.

@jeremystretch commented on GitHub (Sep 30, 2022): > Instead of assigned objects, the contact itself is listed as many times as number of assignments exist. In this example it is "Dwight Schrute" 2 times while it should be "vm1" and "DM-Scranton". That's not quite what's happening. The objects listed are the _assignments_ of this contact to an object. (They link to the contact itself because there is no UI view for an individual assignment). This behavior is expected, but could stand to be clarified, perhaps by extending the `__str__()` method on ContactAssignment to clearly indicate that it is an assignment of a contact to an object.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7035