summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-02-26 18:32:14 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-02-26 18:32:14 +0100
commit8e0daedce7305de901a67c6750a91e91fcaaca69 (patch)
tree1d6174016adfcc64cd0e790801e3e4baf68ed7e6 /ishtar_common/models.py
parent40d6630adea200338241d322df616745783b59a5 (diff)
downloadIshtar-8e0daedce7305de901a67c6750a91e91fcaaca69.tar.bz2
Ishtar-8e0daedce7305de901a67c6750a91e91fcaaca69.zip
Manage hierarchical help text message for types (refs #3759)
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r--ishtar_common/models.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 7798c722d..923d0bb31 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -516,8 +516,18 @@ class GeneralType(Cached, models.Model):
help_items = u"\n"
for item in cls.get_types(dct=dct, instances=True, exclude=exclude):
if hasattr(item, '__iter__'):
- # TODO: manage multiple levels
- continue
+ pk = item[0]
+ item = cls.objects.get(pk=pk)
+ item.rank = c_rank + 1
+ if hasattr(item, 'parent'):
+ c_item = item
+ parents = []
+ while c_item.parent:
+ parents.append(c_item.parent.label)
+ c_item = c_item.parent
+ parents.reverse()
+ parents.append(item.label)
+ item.label = u" / ".join(parents)
if not item.comment:
continue
if c_rank > item.rank: