- Timestamp:
- Feb 2, 2010, 3:35:55 AM (16 years ago)
- Branches:
- master, client
- Children:
- 4bde242
- Parents:
- 3e29d7a
- git-author:
- Alex Dehnert <adehnert@…> (02/02/10 03:35:55)
- git-committer:
- Alex Dehnert <adehnert@…> (02/02/10 03:35:55)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
treasury/finance_core/models.py
r064683a ref1e2a2 53 53 @classmethod 54 54 def get_by_path(cls, path): 55 root = BudgetArea.objects.get(name=path[0], depth=1) 55 try: 56 root = BudgetArea.objects.get(name=path[0], depth=1) 57 except IndexError, e: 58 raise KeyError(e) 56 59 node = root 57 60 for name in path[1:]: 58 node = node.get_children().filter(name=name)[0] 61 try: 62 node = node.get_children().filter(name=name)[0] 63 except IndexError, e: 64 raise KeyError(e) 59 65 return node 66 67 @classmethod 68 def get_by_pathstr(cls, path): 69 path = path.split('.') 70 return cls.get_by_path(path) 71 72 def pathstr(self): 73 parent = self.get_parent() 74 if parent: 75 prefix = parent.pathstr() + '.' 76 else: 77 prefix = '' 78 return prefix + self.name 60 79 61 80 def dump_to_html(self):
Note: See TracChangeset
for help on using the changeset viewer.