From f4f80f3b5f716fea97cfa58612ef1d04ada378c1 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 7 Feb 2022 18:30:32 +0100 Subject: Minor fixes: fix field name on doc dup - more explicit resume on deletion --- ishtar_common/forms_common.py | 2 +- ishtar_common/models_common.py | 4 ++++ ishtar_common/templates/ishtar/wizard/delete_wizard.html | 2 +- ishtar_common/wizards.py | 5 ++--- 4 files changed, 8 insertions(+), 5 deletions(-) (limited to 'ishtar_common') diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index 935436eaa..0e4cc68db 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -2068,7 +2068,7 @@ class QADocumentFormMulti(QAForm): class QADocumentDuplicateForm(IshtarForm): - qa_title = forms.CharField(label=_("Reference"), max_length=500, required=False) + qa_title = forms.CharField(label=_("Title"), max_length=500, required=False) qa_source_type = forms.ChoiceField(label=_("Type"), choices=[], required=False) TYPES = [ diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index b605d13f2..109174439 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -3121,6 +3121,10 @@ class MainItem(ShortMenuItem): QUICK_ACTIONS = [] + @classmethod + def class_verbose_name(cls): + return cls._meta.verbose_name + @classmethod def get_quick_actions(cls, user, session=None, obj=None): """ diff --git a/ishtar_common/templates/ishtar/wizard/delete_wizard.html b/ishtar_common/templates/ishtar/wizard/delete_wizard.html index 9b925f143..625b7a823 100644 --- a/ishtar_common/templates/ishtar/wizard/delete_wizard.html +++ b/ishtar_common/templates/ishtar/wizard/delete_wizard.html @@ -7,7 +7,7 @@ {% if current_objs and current_objs.1 %} {% trans "Are you sure to want to delete these items?" %} {% else %} {% trans "Are you sure to want to delete this item?" %}{% endif %} diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index 7b636538d..4a8fb9a8d 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -1774,15 +1774,14 @@ class MultipleDeletionWizard(MultipleItemWizard): value = str(value) res[field.name] = (label, value, "") full_res.append(res) - if not datas and self.fields: - datas = [["", []]] datas = [] for idx, res in enumerate(full_res): data = [] for field in self.fields: if field in res: data.append(res[field]) - datas.append((str(self.current_objs[idx]), data)) + obj = self.current_objs[idx] + datas.append((f"{obj.class_verbose_name()} - {obj}", data)) return datas def get_context_data(self, form, **kwargs): -- cgit v1.2.3