@parse_data
@set_database
def get_topic_nodes(parent=None, ids=None, **kwargs):
 if parent:
  Parent = Item.alias()
  if (parent == 'root'):
   selector = Parent.parent.is_null()
  else:
   selector = (Parent.id == parent)
  values = Item.select(Item.title, Item.description, Item.available, Item.kind, Item.children, Item.id, Item.path, Item.slug).join(Parent, on=(Item.parent == Parent.pk)).where((selector & Item.available))
  return values
 elif ids:
  values = Item.select(Item.title, Item.description, Item.available, Item.kind, Item.children, Item.id, Item.path, Item.slug).where(Item.id.in_(ids))
  return values

@ parse_data @ set_database def get_topic_nodes ( parent = None , ids = None , ** kwargs ) : if parent : Parent = Item . alias ( ) if ( parent == 'root' ) : selector = Parent . parent . is_null ( ) else : selector = ( Parent . id == parent ) values = Item . select ( Item . title , Item . description , Item . available , Item . kind , Item . children , Item . id , Item . path , Item . slug ) . join ( Parent , on = ( Item . parent == Parent . pk ) ) . where ( ( selector & Item . available ) ) return values elif ids : values = Item . select ( Item . title , Item . description , Item . available , Item . kind , Item . children , Item . id , Item . path , Item . slug ) . where ( Item . id . in_ ( ids ) ) return values
convenience function for returning a set of topic nodes with limited fields for rendering the topic tree can either pass in the parent id to return all the immediate children of a node .