Skip to content

Commit 2c1e681

Browse files
Merge pull request #8584 from 991jo/assigned_contacts_fix
Fixes #8577: Contact assignment amounts not shown during contact glob…
2 parents f11ad99 + 311ddf8 commit 2c1e681

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

netbox/netbox/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from ipam.models import Aggregate, ASN, IPAddress, Prefix, VLAN, VRF
1919
from ipam.tables import AggregateTable, ASNTable, IPAddressTable, PrefixTable, VLANTable, VRFTable
2020
from tenancy.filtersets import ContactFilterSet, TenantFilterSet
21-
from tenancy.models import Contact, Tenant
21+
from tenancy.models import Contact, Tenant, ContactAssignment
2222
from tenancy.tables import ContactTable, TenantTable
2323
from utilities.utils import count_related
2424
from virtualization.filtersets import ClusterFilterSet, VirtualMachineFilterSet
@@ -186,7 +186,7 @@
186186
'url': 'tenancy:tenant_list',
187187
}),
188188
('contact', {
189-
'queryset': Contact.objects.prefetch_related('group', 'assignments'),
189+
'queryset': Contact.objects.prefetch_related('group', 'assignments').annotate(assignment_count=count_related(ContactAssignment, 'contact')),
190190
'filterset': ContactFilterSet,
191191
'table': ContactTable,
192192
'url': 'tenancy:contact_list',

0 commit comments

Comments
 (0)