diff options
| -rw-r--r-- | docs/fr/source/annexe-tech-3-variables-gen.rst | 22 | ||||
| -rw-r--r-- | docs/generate_values_doc.py | 5 | ||||
| -rw-r--r-- | ishtar_common/forms_common.py | 6 | ||||
| -rw-r--r-- | ishtar_common/models.py | 28 | ||||
| -rw-r--r-- | ishtar_common/models_imports.py | 14 | ||||
| -rw-r--r-- | ishtar_common/utils.py | 9 | 
6 files changed, 45 insertions, 39 deletions
diff --git a/docs/fr/source/annexe-tech-3-variables-gen.rst b/docs/fr/source/annexe-tech-3-variables-gen.rst index faa1940ac..764fd10ab 100644 --- a/docs/fr/source/annexe-tech-3-variables-gen.rst +++ b/docs/fr/source/annexe-tech-3-variables-gen.rst @@ -7,9 +7,9 @@ Annexe technique 3 - Variables  ==============================  :Auteurs: Étienne Loks, Ishtar team -:Date: 2024-10-09 +:Date: 2024-10-11  :Copyright: CC-BY 3.0 -:Ishtar Version: v4.1.38 +:Ishtar Version: v4.1.42  ---------------------------------- @@ -152,7 +152,7 @@ Documentation  - **additional_information** : *Texte* - Information supplémentaire  - **administrativeacts__** : *→ Actes administratifs (documents)*  - **areas__** : *→ Zones* (documents - **label** Dénomination, **txt_idx** Identifiant textuel) -- **associated_file** : *Fichier (255)* - Fichier associé - La taille maximale supportée pour le fichier est de 100 Mo. +- **associated_file** : *Fichier (255)* - Fichier associé - La taille maximale supportée pour le fichier est de `MAX_UPLOAD_SIZE` Mo.  - **associated_links** : *Texte* - Liens symboliques  - **associated_url** : *Adresse web (1000)* - Ressource numérique (adresse web)  - **authors__** : *→ Auteur* - Auteurs  @@ -176,7 +176,7 @@ Documentation  - **files__** : *→ Dossiers archéologiques (documents)*  - **finds__** : *→ Mobilier (documents)*  - **format_type__** : *→ Type de format* (**label** Dénomination, **txt_idx** Identifiant textuel) - Format  -- **image** : *Image (255)* - image - La taille maximale supportée pour le fichier est de 100 Mo. +- **image** : *Image (255)* - image - La taille maximale supportée pour le fichier est de `MAX_UPLOAD_SIZE` Mo.  - **imports_updated__** : *→ Import - Import* - Mis à jour par les imports   - **index** : *Entier positif* - Index  - **internal_reference** : *Texte* - Réf. interne @@ -214,7 +214,7 @@ Documentation  - **source_type__** : *→ Type de document* (**label** Dénomination, **txt_idx** Identifiant textuel) - Type   - **support_type__** : *→ Type de support* (**label** Dénomination, **txt_idx** Identifiant textuel) - Support   - **tags__** : *→ Mot-clé du document* (**label** Dénomination, **txt_idx** Identifiant textuel) - Mots-clés  -- **thumbnail** : *Image (255)* - thumbnail - La taille maximale supportée pour le fichier est de 100 Mo. +- **thumbnail** : *Image (255)* - thumbnail - La taille maximale supportée pour le fichier est de `MAX_UPLOAD_SIZE` Mo.  - **title** : *Texte* - Titre  - **towns__** : *→ Communes* (documents - **name** Nom, **numero_insee** Code commune (numéro INSEE), **cached_label** Nom en cache)  - **treatment_files__** : *→ Demandes de traitement (documents)* @@ -448,8 +448,8 @@ Chaque opération dispose du champ `data__` ainsi que des champs suivants :  - **protagonist__** : *→ Personne* - Nom du protagoniste   - **qrcode** : *Image (255)* - qrcode  - **record_quality_type__** : *→ Type de qualité d'enregistrement* (**label** Dénomination, **txt_idx** Identifiant textuel) - Qualité d'enregistrement  -- **relation_bitmap_image** : *Fichier (100)* - Image des relations (PNG généré) - La taille maximale supportée pour le fichier est de 100 Mo. -- **relation_image** : *Fichier (100)* - Image des relations (SVG généré) - La taille maximale supportée pour le fichier est de 100 Mo. +- **relation_bitmap_image** : *Fichier (100)* - Image des relations (PNG généré) - La taille maximale supportée pour le fichier est de `MAX_UPLOAD_SIZE` Mo. +- **relation_image** : *Fichier (100)* - Image des relations (SVG généré) - La taille maximale supportée pour le fichier est de `MAX_UPLOAD_SIZE` Mo.  - **remains__** : *→ Type de vestige* (**label** Dénomination, **txt_idx** Identifiant textuel) - Vestiges   - **report_delivery_date** : *Date* - Date de livraison du rapport  - **report_processing__** : *→ Type d'état de rapport* (**label** Dénomination, **txt_idx** Identifiant textuel) - Traitement du rapport  @@ -691,8 +691,8 @@ Chaque unité d'enregistrement dispose du champ `data__` ainsi que des champs su  - **parcel__** : *→ Parcelle* - Parcelle   - **qrcode** : *Image (255)* - qrcode  - **related_context_records__** : *→ Unité d'Enregistrement* - related context records  -- **relation_bitmap_image** : *Fichier (100)* - Image des relations (PNG généré) - La taille maximale supportée pour le fichier est de 100 Mo. -- **relation_image** : *Fichier (100)* - Image des relations (SVG généré) - La taille maximale supportée pour le fichier est de 100 Mo. +- **relation_bitmap_image** : *Fichier (100)* - Image des relations (PNG généré) - La taille maximale supportée pour le fichier est de `MAX_UPLOAD_SIZE` Mo. +- **relation_image** : *Fichier (100)* - Image des relations (SVG généré) - La taille maximale supportée pour le fichier est de `MAX_UPLOAD_SIZE` Mo.  - **right_relations__** : *→ Relations entre Unités d'Enregistrement (left record)*  - **spatial_reference_system__** : *→ Géographie - Système de référence spatiale* (**label** Dénomination, **txt_idx** Identifiant textuel, **srid** SRID, **auth_name** Registre) - Système de référence spatiale   - **structures__** : *→ Type de structure* (**label** Dénomination, **txt_idx** Identifiant textuel) - structures  @@ -903,7 +903,7 @@ Chaque traitement dispose du champ `data__` ainsi que des champs suivants :  - **findtreatments__** : *→ find treatments (traitement)*  - **findupstreamtreatments__** : *→ find upstream treatments (traitement)*  - **goal** : *Texte* - But -- **image** : *Image (255)* - image - La taille maximale supportée pour le fichier est de 100 Mo. +- **image** : *Image (255)* - image - La taille maximale supportée pour le fichier est de `MAX_UPLOAD_SIZE` Mo.  - **imports_updated__** : *→ Import - Import* - Mis à jour par les imports   - **index** : *Entier positif* - Index  - **insurance_cost** : *Nombre à virgule* - Coût d'assurance @@ -918,7 +918,7 @@ Chaque traitement dispose du champ `data__` ainsi que des champs suivants :  - **realized_cost** : *Nombre à virgule* - Coût réalisé  - **scientific_monitoring_manager__** : *→ Personne* - Responsable de suivi scientifique   - **start_date** : *Date* - Date de début -- **thumbnail** : *Image (255)* - thumbnail - La taille maximale supportée pour le fichier est de 100 Mo. +- **thumbnail** : *Image (255)* - thumbnail - La taille maximale supportée pour le fichier est de `MAX_UPLOAD_SIZE` Mo.  - **treatment_state__** : *→ Type d'état de traitement* (**label** Dénomination, **txt_idx** Identifiant textuel) - État   - **treatment_types__** : *→ Type de traitement* (**label** Dénomination, **txt_idx** Identifiant textuel) - Type de traitement   - **upstream__** : *→ Mobilier (traitement aval)* diff --git a/docs/generate_values_doc.py b/docs/generate_values_doc.py index dac4539b1..6d9ca6d42 100644 --- a/docs/generate_values_doc.py +++ b/docs/generate_values_doc.py @@ -97,7 +97,10 @@ def get_values(tpl_model, model, excluded, model_types, messages):          if getattr(field, "help_text", None):              h = field.help_text              if callable(h): -                h = h() +                try: +                    h = h(help_for_doc=True) +                except TypeError: +                    h = h()              help_text = str(h)          if getattr(field, "related_model", None): diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index cccae23eb..0f458ec51 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -1936,7 +1936,9 @@ class MergeOrganizationForm(MergeForm):      TO_KEY = "to_organization" -def get_image_help(): +def get_image_help(help_for_doc=False): +    if help_for_doc: +        return max_size_help      if not settings.IMAGE_MAX_SIZE:          return max_size_help()      return ( @@ -2141,7 +2143,7 @@ class DocumentForm(forms.ModelForm, CustomForm, ManageOldType):          label=pgettext("Not directory", "File"),          max_length=255,          required=False, -        help_text=max_size_help(), +        help_text=max_size_help,          validators=[file_size_validator],      )      reference = forms.CharField( diff --git a/ishtar_common/models.py b/ishtar_common/models.py index c7fe7be8a..688197c73 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -484,14 +484,14 @@ class ImageModel(models.Model, ImageContainerModel):          blank=True,          null=True,          max_length=255, -        help_text=max_size_help(), +        help_text=max_size_help,      )      thumbnail = models.ImageField(          upload_to=get_image_path,          blank=True,          null=True,          max_length=255, -        help_text=max_size_help(), +        help_text=max_size_help,      )      DUPLICATE_EXCLUDE = ["image", "thumbnail"]      IMAGE_MAX_SIZE = settings.IMAGE_MAX_SIZE @@ -587,63 +587,63 @@ class RelationItem(models.Model):          null=True,          blank=True,          upload_to=get_image_path, -        help_text=max_size_help(), +        help_text=max_size_help,      )      relation_bitmap_image = models.FileField(          _("Generated relation image (PNG)"),          null=True,          blank=True,          upload_to=get_image_path, -        help_text=max_size_help(), +        help_text=max_size_help,      )      relation_dot = models.FileField(          _("Generated relation image (DOT)"),          null=True,          blank=True,          upload_to=get_image_path, -        help_text=max_size_help(), +        help_text=max_size_help,      )      relation_image_above = models.FileField(          _("Generated above relation image (SVG)"),          null=True,          blank=True,          upload_to=get_image_path, -        help_text=max_size_help(), +        help_text=max_size_help,      )      relation_dot_above = models.FileField(          _("Generated above relation image (DOT)"),          null=True,          blank=True,          upload_to=get_image_path, -        help_text=max_size_help(), +        help_text=max_size_help,      )      relation_bitmap_image_above = models.FileField(          _("Generated above relation image (PNG)"),          null=True,          blank=True,          upload_to=get_image_path, -        help_text=max_size_help(), +        help_text=max_size_help,      )      relation_image_below = models.FileField(          _("Generated below relation image (SVG)"),          null=True,          blank=True,          upload_to=get_image_path, -        help_text=max_size_help(), +        help_text=max_size_help,      )      relation_dot_below = models.FileField(          _("Generated below relation image (DOT)"),          null=True,          blank=True,          upload_to=get_image_path, -        help_text=max_size_help(), +        help_text=max_size_help,      )      relation_bitmap_image_below = models.FileField(          _("Generated below relation image (PNG)"),          null=True,          blank=True,          upload_to=get_image_path, -        help_text=max_size_help(), +        help_text=max_size_help,      )      class Meta: @@ -2087,7 +2087,7 @@ class DocumentTemplate(models.Model):          upload_to="templates/%Y/",          blank=True,          null=True, -        help_text=max_size_help(), +        help_text=max_size_help,      )      export_format = models.CharField(_("Export format"), max_length=4, choices=EXPORT_FORMATS, blank=True, default="")      label_template = models.FileField( @@ -2095,7 +2095,7 @@ class DocumentTemplate(models.Model):          upload_to="templates/%Y/",          blank=True,          null=True, -        help_text=max_size_help(), +        help_text=max_size_help,      )      label_targets = models.TextField(          _("Labels: targets for labels in the LibreOffice file"), @@ -4574,7 +4574,7 @@ class Document(          blank=True,          null=True,          max_length=255, -        help_text=max_size_help(), +        help_text=max_size_help,      )      index = models.IntegerField(verbose_name=_("Index"), blank=True, null=True)      external_id = models.TextField(_("External ID"), blank=True, default="") diff --git a/ishtar_common/models_imports.py b/ishtar_common/models_imports.py index a499a9b12..9045de0c2 100644 --- a/ishtar_common/models_imports.py +++ b/ishtar_common/models_imports.py @@ -1390,7 +1390,7 @@ class BaseImport(models.Model, OwnPerms, SheetItem):          _("Imported file"),          upload_to="upload/imports/%Y/%m/",          max_length=220, -        help_text=max_size_help(), +        help_text=max_size_help,          blank=True,          null=True,      ) @@ -1400,7 +1400,7 @@ class BaseImport(models.Model, OwnPerms, SheetItem):          blank=True,          null=True,          max_length=220, -        help_text=max_size_help(), +        help_text=max_size_help,      )      archive_file = models.FileField(          _("Archive file"), @@ -1408,7 +1408,7 @@ class BaseImport(models.Model, OwnPerms, SheetItem):          blank=True,          null=True,          max_length=255, -        help_text=max_size_help(), +        help_text=max_size_help,      )      encoding = models.CharField(          _("Encoding"), choices=ENCODINGS, default="utf-8", max_length=15, @@ -1933,7 +1933,7 @@ class Import(BaseImport):          _("Imported values"),          upload_to="upload/imports/%Y/%m/",          max_length=220, -        help_text=max_size_help(), +        help_text=max_size_help,          blank=True,          null=True,      ) @@ -1943,7 +1943,7 @@ class Import(BaseImport):          blank=True,          null=True,          max_length=255, -        help_text=max_size_help(), +        help_text=max_size_help,      )      result_file = models.FileField(          _("Result file"), @@ -1951,7 +1951,7 @@ class Import(BaseImport):          blank=True,          null=True,          max_length=255, -        help_text=max_size_help(), +        help_text=max_size_help,      )      match_file = models.FileField(          _("Match file"), @@ -1959,7 +1959,7 @@ class Import(BaseImport):          blank=True,          null=True,          max_length=255, -        help_text=max_size_help(), +        help_text=max_size_help,      )      state = models.CharField(          _("State"), max_length=2, choices=IMPORT_STATE, default="C" diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index d4453ff5a..95a7ebbaa 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -2005,10 +2005,11 @@ def m2m_historization_changed(sender, **kwargs):      obj.save() -def max_size_help(): -    msg = str(_("The maximum supported file size is {} Mo.")).format( -        settings.MAX_UPLOAD_SIZE -    ) +def max_size_help(help_for_doc=False): +    max_size = settings.MAX_UPLOAD_SIZE +    if help_for_doc: +        max_size = '`MAX_UPLOAD_SIZE`' +    msg = str(_("The maximum supported file size is {} Mo.")).format(max_size)      return msg  | 
