diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-24 12:08:13 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-28 12:15:25 +0100 |
commit | 06d2cde5260c46d865b3032e6be33a4340edf3d4 (patch) | |
tree | 166a9fb5fa9201419f2acb44438dca6a49a29b39 /docs | |
parent | 612430e46099185846f1b8e07d8653791a1208a2 (diff) | |
download | Ishtar-06d2cde5260c46d865b3032e6be33a4340edf3d4.tar.bz2 Ishtar-06d2cde5260c46d865b3032e6be33a4340edf3d4.zip |
Documentation: update values
Diffstat (limited to 'docs')
-rw-r--r-- | docs/fr/source/annexe-tech-3-variables-gen.rst | 6 | ||||
-rw-r--r-- | docs/generate_values_doc.py | 18 |
2 files changed, 17 insertions, 7 deletions
diff --git a/docs/fr/source/annexe-tech-3-variables-gen.rst b/docs/fr/source/annexe-tech-3-variables-gen.rst index 7e4a85753..7e40af1a8 100644 --- a/docs/fr/source/annexe-tech-3-variables-gen.rst +++ b/docs/fr/source/annexe-tech-3-variables-gen.rst @@ -7,7 +7,7 @@ Annexe technique 3 - Variables ============================== :Auteurs: Étienne Loks, Ishtar team -:Date: 2021-02-09 +:Date: 2021-02-24 :Copyright: CC-BY 3.0 :Ishtar Version: v3.1.0 @@ -734,6 +734,7 @@ Chaque contenant dispose des :ref:`champs géographiques <valeurs-champs-geo>`, - **container_tree_child__** : *→ container tree (contenant)* - **container_tree_parent__** : *→ container trees (container parent)* - **container_type__** : *→ Type de contenant* (**label** Dénomination, **txt_idx** Identifiant textuel) - Type de contenant +- **context_record_** : Associated context record - use it with caution, only return the first found context_record - **Field only available for template generation** - **custom_index** : *Entier* - Custom index - **division__** : *→ Localisations de contenant (contenant)* - **documents__** : *→ Document* - Documents @@ -744,10 +745,11 @@ Chaque contenant dispose des :ref:`champs géographiques <valeurs-champs-geo>`, - **location__** : *→ Lieu de conservation* - Localisation (lieu de conservation) - **main_image__** : *→ Document* - Image principale - **old_reference** : *Texte* - Ancienne référence +- **operation_** : Associated operation - use it with caution, only return the first found operation - **Field only available for template generation** - **parent__** : *→ Contenant* - Parent container - **qrcode** : *Image (255)* - qrcode - **reference** : *Texte* - Réf. du contenant -- **responsibility__** : *→ Lieu de conservation* - Responsibility - Warehouse that own the container +- **responsibility__** : *→ Lieu de conservation* - Responsibility - Warehouse that owns the container - **responsible__** : *→ Lieu de conservation* - Lieu de conservation responsable - Deprecated - do not use - **spatial_reference_system__** : *→ 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 - **treatment__** : *→ Traitements (contenant)* diff --git a/docs/generate_values_doc.py b/docs/generate_values_doc.py index 73dc41f5e..f93ebd6dc 100644 --- a/docs/generate_values_doc.py +++ b/docs/generate_values_doc.py @@ -1,6 +1,6 @@ from django.apps import apps from django.conf import settings -from django.utils.translation import activate +from django.utils.translation import activate, ugettext as _ import datetime from jinja2 import Template @@ -64,8 +64,12 @@ MODELS = { "archaeological_warehouse": ["warehouse", "container"], } +MESSAGES = { + 'value_only_message': _("Field only available for template generation") +} + -def get_values(tpl_model, model, excluded, model_types): +def get_values(tpl_model, model, excluded, model_types, messages): fields = {} related_fields = {} for field in model._meta.get_fields(): @@ -130,6 +134,10 @@ def get_values(tpl_model, model, excluded, model_types): fields[field.name] += " - " + help_text else: print("No doc for the field: " + field.name) + if hasattr(model, "DOC_VALUES"): + for k, v in model.DOC_VALUES: + fields[k] = "{} - **{}**".format( + v, messages["value_only_message"]) fields = sorted(list(fields.items()) + list(related_fields.items())) return { @@ -147,12 +155,12 @@ for template_name, template_name_dest, language in TEMPLATES: excluded = EXCLUDED[:] address_values = get_values(tpl_model, Address, excluded=excluded, - model_types=TYPES) + model_types=TYPES, messages=MESSAGES) render_dct["ishtar_common"]["address"] = address_values excluded += address_values["fields"] geo_values = get_values(tpl_model, GeoItem, excluded=excluded, - model_types=TYPES) + model_types=TYPES, messages=MESSAGES) render_dct["ishtar_common"]["geoitem"] = geo_values excluded += geo_values["fields"] @@ -162,7 +170,7 @@ for template_name, template_name_dest, language in TEMPLATES: for model_name in MODELS[app_name]: model = apps.get_app_config(app_name).get_model(model_name) render_dct[app_name][model_name] = get_values( - tpl_model, model, excluded, TYPES) + tpl_model, model, excluded, TYPES, messages=MESSAGES) template_name = os.path.abspath( settings.ROOT_PATH + "../docs/" + template_name) |