1👍
✅
distinct()
method removes duplicate categories from queryset. Try this:
Category.objects.distinct().filter(allowed_groups__in=user.groups.all())
Source:stackexchange.com