Browse Source

Trivialni zobrazovatko TreeNode.

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

8
seminar/models.py

@ -1152,6 +1152,14 @@ class TreeNode(models.Model):
blank = True, blank = True,
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:

Loading…
Cancel
Save