parameters: (queryset=None, filter=None)
return_statement: return queryset.model.objects.filter(Q(id__in=queryset.values_list('id')) | descendants)
docstring: :param queryset: Model Queryset to add descendants
          :param filter: Filter (exclude) the descendants nodes with the provided Q filter
docstring_summary: :param queryset: Model Queryset to add descendants
          :param filter: Filter (exclude) the descendants nodes with the provided Q filter
docstring_tokens: : param queryset : Model Queryset to add descendants : param filter : Filter ( exclude ) the descendants nodes with the provided Q filter
function: def include_descendants(queryset=None, filter=None):
          """
          :param queryset: Model Queryset to add descendants
          :param filter: Filter (exclude) the descendants nodes with the provided Q filter
          """
          descendants = Q()
          # TODO filter the queryset nodes to exclude descendants of objects in the queryset
          nodes = queryset.values('path', 'depth')
          for node in nodes:
              descendants |= Q(path__startswith=node['path'], depth__gt=node['depth'])
  
          return queryset.model.objects.filter(Q(id__in=queryset.values_list('id')) | descendants)
function_tokens: def include_descendants ( queryset = None , filter = None ) : descendants = Q ( ) # TODO filter the queryset nodes to exclude descendants of objects in the queryset nodes = queryset . values ( 'path' , 'depth' ) for node in nodes : descendants |= Q ( path__startswith = node [ 'path' ] , depth__gt = node [ 'depth' ] ) return queryset . model . objects . filter ( Q ( id__in = queryset . values_list ( 'id' ) ) | descendants )