Skip to content

Commit

Permalink
fixes contact assignments filter to include parent content type #12730
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi1693 authored and jeremystretch committed May 26, 2023
1 parent b64b19a commit e2f9a3c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion netbox/tenancy/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ class ObjectContactsView(generic.ObjectChildrenView):
def get_children(self, request, parent):
return Contact.objects.annotate(
assignment_count=count_related(ContactAssignment, 'contact')
).restrict(request.user, 'view').filter(assignments__object_id=parent.pk)
).restrict(request.user, 'view').filter(
assignments__content_type=ContentType.objects.get_for_model(parent),
assignments__object_id=parent.pk
)

def get_extra_context(self, request, instance):
return {
Expand Down

0 comments on commit e2f9a3c

Please sign in to comment.