Browse Source

Trivialni zobrazovatko TreeNode.

export_seznamu_prednasek
parent
commit
7ad91da45c
  1. 8
      seminar/models.py

8
seminar/models.py

@ -1153,6 +1153,14 @@ class TreeNode(models.Model):
on_delete=models.SET_NULL, on_delete=models.SET_NULL,
verbose_name="další element na stejné úrovni") verbose_name="další element na stejné úrovni")
def print_tree(self,indent=0):
print("{}TreeNode({})".format(" "*indent,self.id))
if self.first_child:
self.first_child.print_tree(indent=indent+2)
if self.succ:
self.succ.print_tree(indent=indent)
class RocnikNode(TreeNode): class RocnikNode(TreeNode):
class Meta: class Meta:
db_table = 'seminar_nodes_rocnik' db_table = 'seminar_nodes_rocnik'

Loading…
Cancel
Save