From 801e31fc093bc554ae62ff50a5540659634098b4 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 13 Sep 2019 12:28:23 +0200 Subject: Fix organization form - fix quick add with delayed cached_label --- ishtar_common/views_item.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ishtar_common/views_item.py') diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py index ea76380fa..4e29a2bcf 100644 --- a/ishtar_common/views_item.py +++ b/ishtar_common/views_item.py @@ -160,7 +160,10 @@ def new_qa_item(model, frm, many=False): dct['form'] = frm(request.POST, limits=limits) if dct['form'].is_valid(): new_item = dct['form'].save(request.user) - dct['new_item_label'] = str(new_item) + lbl = str(new_item) + if not lbl and hasattr(new_item, "_generate_cached_label"): + lbl = new_item._generate_cached_label() + dct['new_item_label'] = lbl dct['new_item_pk'] = new_item.pk dct['parent_pk'] = parent_name if dct['parent_pk'] and '_select_' in dct['parent_pk']: -- cgit v1.2.3