def leaves(self):
        """ Returns a :class:`QuerySet` of all leaf nodes (nodes with no
            children).

            :return: A :class:`QuerySet` of all leaf nodes (nodes with no
                children).
        """
        # We need to read the _cte_node_children attribute, so ensure it exists.
        self._ensure_parameters()
        return self.exclude(
            **{"%s__id__in" % self.model._cte_node_children: self.all()}
        )
Returns a :class:`QuerySet` of all leaf nodes (nodes with no
            children).

            :return: A :class:`QuerySet` of all leaf nodes (nodes with no
                children).