Tenant Contacts tab shows some contacts not assigned to that tenant #8151

Closed
opened 2025-12-29 20:33:07 +01:00 by adam · 2 comments
Owner

Originally created by @candlerb on GitHub (Jun 1, 2023).

NetBox version

v3.5.2

Python version

3.8

Steps to Reproduce

Short version: the contacts tab at /tenancy/tenants/1/contacts/ shows some contacts which are not assigned to the tenant.

image

Long version: I have the following objects

  • Site "Test"
  • Locations "Brian Office", "Under Stairs"
  • Rack "test-rack" (assigned to Site but not to any Location)
  • Tenant "test-tenant" (id 1)
  • Contact role "admin"
  • Contact groups "group1", "group2" (no parent-child relationship)
  • Contact "brian" with no group
  • Contacts "contact1" and "contact2" in group "group1"
  • Contacts "contact3" and "contact4" in group "group2"
  • Contact assignments:
    • contact1 assigned to Location "Under Stairs", role Admin
    • contact1 assigned to Location "Brian Office", role Admin
    • contact2 assigned to Location "Under Stairs", role Admin
    • contact3 assigned to Rack "test-rack", role Admin
    • Brian assigned to Tenant "test-tenant", role Admin

image

Expected Behavior

When I view /tenancy/tenants/1/contacts/, I should see only the contacts which are assigned to tenant id=1.

Observed Behavior

As per first image shown above, I see some extra contacts (but not all of them). I'm struggling to work out which ones it is including and why.

The table shows the following contacts:

  • Brian, assignments count = 1. Links to /tenancy/contact-assignments/?contact_id=1 which shows Brian assigned to Tenant 1 as expected
  • contact1, assignments count = 2. Links to /tenancy/contact-assignments/?contact_id=2 which shows contact1 assigned to Location "Under Stairs" and Location "Brian Office"
  • contact2, assignments count = 1. Links to /tenancy/contact-assignments/?contact_id=3 which shows contact2 assigned to Location "Under Stairs"

If I go to /tenancy/tenants/1/ then the "Related objects" column on the right shows "—" for every object type.

Originally created by @candlerb on GitHub (Jun 1, 2023). ### NetBox version v3.5.2 ### Python version 3.8 ### Steps to Reproduce Short version: the contacts tab at `/tenancy/tenants/1/contacts/` shows some contacts which are not assigned to the tenant. ![image](https://github.com/netbox-community/netbox/assets/44789/097c6099-7996-4b32-90f7-698732a4fb6c) Long version: I have the following objects * Site "Test" * Locations "Brian Office", "Under Stairs" * Rack "test-rack" (assigned to Site but not to any Location) * Tenant "test-tenant" (id 1) * Contact role "admin" * Contact groups "group1", "group2" (no parent-child relationship) * Contact "brian" with no group * Contacts "contact1" and "contact2" in group "group1" * Contacts "contact3" and "contact4" in group "group2" * Contact assignments: * contact1 assigned to Location "Under Stairs", role Admin * contact1 assigned to Location "Brian Office", role Admin * contact2 assigned to Location "Under Stairs", role Admin * contact3 assigned to Rack "test-rack", role Admin * Brian assigned to Tenant "test-tenant", role Admin ![image](https://github.com/netbox-community/netbox/assets/44789/7db3394b-e1f0-4b58-bcad-8ad45471f640) ### Expected Behavior When I view `/tenancy/tenants/1/contacts/`, I should see only the contacts which are assigned to tenant id=1. ### Observed Behavior As per first image shown above, I see some extra contacts (but not all of them). I'm struggling to work out which ones it is including and why. The table shows the following contacts: * Brian, assignments count = 1. Links to `/tenancy/contact-assignments/?contact_id=1` which shows Brian assigned to Tenant 1 as expected * contact1, assignments count = 2. Links to `/tenancy/contact-assignments/?contact_id=2` which shows contact1 assigned to Location "Under Stairs" and Location "Brian Office" * contact2, assignments count = 1. Links to `/tenancy/contact-assignments/?contact_id=3` which shows contact2 assigned to Location "Under Stairs" If I go to `/tenancy/tenants/1/` then the "Related objects" column on the right shows "—" for every object type.
adam added the status: duplicate label 2025-12-29 20:33:07 +01:00
adam closed this issue 2025-12-29 20:33:07 +01:00
Author
Owner

@candlerb commented on GitHub (Jun 1, 2023):

Hmm: the problem is not just limited to tenants.

/dcim/locations/1/contacts/ (location "Under Stairs") shows:

  • Brian (assignments=1)
  • contact1 (assignments=2)
  • contact2 (assignments=1)
    But of those, only contact1 and contact2 are assigned to this location.

However, /dcim/locations/9/contacts/ (location "Brian Office") correctly shows only:

  • contact1 (assignments=2)

I'll see if I can get Django to log the queries it is making.

@candlerb commented on GitHub (Jun 1, 2023): Hmm: the problem is not just limited to tenants. `/dcim/locations/1/contacts/` (location "Under Stairs") shows: * Brian (assignments=1) * contact1 (assignments=2) * contact2 (assignments=1) But of those, only contact1 and contact2 are assigned to this location. However, `/dcim/locations/9/contacts/` (location "Brian Office") correctly shows only: * contact1 (assignments=2) I'll see if I can get Django to log the queries it is making.
Author
Owner

@abhi1693 commented on GitHub (Jun 1, 2023):

Duplicate of https://github.com/netbox-community/netbox/issues/12730

@abhi1693 commented on GitHub (Jun 1, 2023): Duplicate of https://github.com/netbox-community/netbox/issues/12730
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8151