I am trying to get the count of infringements in the market place for the logged in user. The logged user is part of a group. The problem I am having is its still counting values for marketplace items that doesn't belong to the group. It adds 0 in the queryset breaking my charts,
u = request.user.groups.all()[0].id
mar_count = Marketplace.objects.annotate(infringement_count=Count('infringement', filter=Q(groups=u)))
The result 'Ebay','Amazon','Facebook','Wallmart', '0','0','0','0','1','1','1','1',
I should be getting 'Ebay','Amazon','Facebook','Wallmart', '1','1','1','1',
How do I exclude counting the marketplace when its no part of the logged in users group? I am new. Thanks