Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_children(self, counter=0):
- children = Assignment.objects.filter(parent=self)
- res = []
- if self.is_awr():
- coassignments = self.coassignments.all()
- for i in coassignments:
- i.cls = 'child-{}'.format(counter) if counter < 10 else '-9'
- res += [i]
- self.check_coassignments(res)
- for child in children:
- child.cls = 'child'
- child.cls += '-{}'.format(counter) if counter < 10 else '-9'
- res.append(child)
- if Assignment.objects.filter(parent=child).count():
- for sub_child in child.get_children(counter=counter + 1):
- res.append(sub_child)
- return res
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement