Exemplo n.º 1
0
	def get_tree(self):
		"""Gets topics tree"""
		children = list(self.get_query_set().select_related().order_by('order'))
		retval = []
		for child in children:
			if not child.parent: #root topic
				retval.extend(recursive_search(child, children, 0))
		return retval
Exemplo n.º 2
0
	def get_tree(self, content_object):
		content_type = ContentType.objects.get_for_model(content_object)
		children = list(self.get_query_set().filter(
			content_type = content_type,
			object_id = getattr(content_object, 'pk', getattr(content_object, 'id')),
		).select_related().order_by('date_submitted'))
		retval = []
		for child in children:
			if not child.parent: #root comment
				retval.extend(recursive_search(child, children, 0))
		return retval