26👍
✅
Did you try attaching a .distinct()
to the queryset?
categories = Category.objects.filter(post__genders=1).exclude(post=
None).order_by('-sort').distinct()
Source:stackexchange.com