From 8e0daedce7305de901a67c6750a91e91fcaaca69 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 26 Feb 2018 18:32:14 +0100 Subject: Manage hierarchical help text message for types (refs #3759) --- ishtar_common/models.py | 14 ++++++++++++-- ishtar_common/templates/blocks/bs_field_snippet.html | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'ishtar_common') 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: diff --git a/ishtar_common/templates/blocks/bs_field_snippet.html b/ishtar_common/templates/blocks/bs_field_snippet.html index f9cdeb68e..549550cef 100644 --- a/ishtar_common/templates/blocks/bs_field_snippet.html +++ b/ishtar_common/templates/blocks/bs_field_snippet.html @@ -18,7 +18,7 @@ {% endif %}
-
+
{{field.help_text}}
-- cgit v1.2.3