Przeglądaj źródła

fixes contact assignments filter to include parent content type #12730

Abhimanyu Saharan 2 lat temu
rodzic
commit
e2f9a3c07a
1 zmienionych plików z 4 dodań i 1 usunięć
  1. 4 1
      netbox/tenancy/views.py

+ 4 - 1
netbox/tenancy/views.py

@@ -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 {