def METHOD_NAME(self, queryset):
    descendant_resources = ContentNode.objects.filter(
        tree_id=OuterRef("tree_id"),
        lft__gt=OuterRef("lft"),
        rght__lt=OuterRef("rght"),
    ).exclude(kind_id=content_kinds.TOPIC)
    return queryset.annotate(
        total_count=(F("rght") - F("lft") - 1) / 2,
        resource_count=SQCount(descendant_resources, field="content_id"),
    )