diff options
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=[  | 
