From 9a2a46a42ea183716aefd2562591483f154e3d21 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 30 Sep 2024 11:30:55 +0200 Subject: 🩹 sheet: fix "full_label" display of hierarchical types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ishtar_common/models_common.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ishtar_common/models_common.py') diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index 9aec54534..403c020dc 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -751,10 +751,14 @@ class HierarchicalType(GeneralType): class Meta: abstract = True + has_full_label = True + def full_label(self): lbls = [self.label] item = self - while item.parent: + parents = [self.pk] # prevent loop + while item.parent and item.parent_id not in parents: + parents.append(item.parent_id) item = item.parent lbls.append(item.label) return " > ".join(reversed(lbls)) -- cgit v1.2.3