I’m using django-taggit. I am tagging action items and info items. I want to list all tags for which there is an info item. I originally wrote:
Tag.objects.filter(info_item__name__isnull=False).annotate(info_item_count=Count('info_item'))
But this is returning some action items. How might I rewrite the query so that the Tags are filtered such that there is an info item attached?
Assuming your info_item model is InfoItem, then try