Skip to content

Commit e2f9a3c

Browse files
abhi1693jeremystretch
authored andcommitted
fixes contact assignments filter to include parent content type #12730
1 parent b64b19a commit e2f9a3c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

netbox/tenancy/views.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ class ObjectContactsView(generic.ObjectChildrenView):
2929
def get_children(self, request, parent):
3030
return Contact.objects.annotate(
3131
assignment_count=count_related(ContactAssignment, 'contact')
32-
).restrict(request.user, 'view').filter(assignments__object_id=parent.pk)
32+
).restrict(request.user, 'view').filter(
33+
assignments__content_type=ContentType.objects.get_for_model(parent),
34+
assignments__object_id=parent.pk
35+
)
3336

3437
def get_extra_context(self, request, instance):
3538
return {

0 commit comments

Comments
 (0)