fixes contact assignments filter to include parent content type #12730

This commit is contained in:
Abhimanyu Saharan 2023-05-26 13:21:42 +05:30 committed by Jeremy Stretch
parent b64b19a3f4
commit e2f9a3c07a

View File

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