diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-05-28 16:27:09 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-05-28 16:27:09 +0200 |
commit | d949cd7866446e30ca3c14926358fc91f1535ded (patch) | |
tree | d5d09f5691aa310199bcc00f60802959a7b3dacd /ishtar_common | |
parent | 0e5ba6e7e7bb6a26fde543cd6cd934f247558afa (diff) | |
download | Ishtar-d949cd7866446e30ca3c14926358fc91f1535ded.tar.bz2 Ishtar-d949cd7866446e30ca3c14926358fc91f1535ded.zip |
✏️ geo, document form: fix label for "Site" when configuration is checked (refs #5890)
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/forms_common.py | 6 | ||||
-rw-r--r-- | ishtar_common/models.py | 2 | ||||
-rw-r--r-- | ishtar_common/models_common.py | 8 |
3 files changed, 13 insertions, 3 deletions
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index 5b2c83f93..6d6e411e3 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -2253,14 +2253,14 @@ class DocumentForm(forms.ModelForm, CustomForm, ManageOldType): if kwargs.get("user", None): self.user = kwargs.pop("user") self.is_instancied = bool(kwargs.get("instance", False)) - super(DocumentForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) fields = OrderedDict() for related_key in models.Document.RELATED_MODELS_ALT: model = models.Document._meta.get_field(related_key).related_model fields[related_key] = widgets.Select2MultipleField( model=model, remote=True, - label=model._meta.verbose_name_plural, + label=model.get_label_for_model_plural(), required=False, style="width: 100%", ) @@ -3175,7 +3175,7 @@ class GISForm(forms.ModelForm, CustomForm, ManageOldType): fields[related_key] = widgets.Select2MultipleField( model=model, remote=True, - label=model._meta.verbose_name_plural, + label=model.get_label_for_model_plural(), required=False, style="width: 100%", ) diff --git a/ishtar_common/models.py b/ishtar_common/models.py index fe7264c51..d13b2eaa2 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -1041,6 +1041,7 @@ SITE_LABELS = [("site", _("Site")), ("entity", _("Archaeological entity"))] TRANSLATED_SITE_LABELS = { "site": { + "plural": _("Sites"), "search": _("Site search"), "new": _("New site"), "modification": _("Site modification"), @@ -1051,6 +1052,7 @@ TRANSLATED_SITE_LABELS = { "name-attached-to-cr": _("Site name (attached to the context record)"), }, "entity": { + "plural": _("Archaeological entities"), "search": _("Archaeological entity search"), "new": _("New archaeological entity"), "modification": _("Archaeological entity modification"), diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index 98c0c6933..f58ff8f09 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -1848,6 +1848,10 @@ class DocumentItem: ), } + @classmethod + def get_label_for_model_plural(cls): + return cls._meta.verbose_name_plural + def documents_list(self) -> list: Document = apps.get_model("ishtar_common", "Document") return self.get_associated_main_item_list("documents", Document) @@ -2936,6 +2940,10 @@ class GeographicItem(models.Model): class Meta: abstract = True + @classmethod + def get_label_for_model_plural(cls): + return cls._meta.verbose_name_plural + def get_add_geo_action(self): return ( reverse("create-pre-geo", args=[ |