summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
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
commitab86d31c813a2c7307cfcf111faace1d6ac53d90 (patch)
tree166a9fb5fa9201419f2acb44438dca6a49a29b39
parent91ec123729a6947bd0bb7230eaa5f6b90265840e (diff)
downloadIshtar-ab86d31c813a2c7307cfcf111faace1d6ac53d90.tar.bz2
Ishtar-ab86d31c813a2c7307cfcf111faace1d6ac53d90.zip
Documentation: update values
-rw-r--r--Makefile.example75
-rw-r--r--docs/fr/source/annexe-tech-3-variables-gen.rst6
-rw-r--r--docs/generate_values_doc.py18
3 files changed, 57 insertions, 42 deletions
diff --git a/Makefile.example b/Makefile.example
index 98ac959e0..3330f3dc7 100644
--- a/Makefile.example
+++ b/Makefile.example
@@ -30,17 +30,49 @@ clean: ## remove temporary files
update: clean syncdb compilemessages collectstatic ## update the instance
+migrations: ## generate database migrations
+ cd $(project);\
+ for APP in "overload_translation" $(apps); do \
+ echo "* makemigrations for "$$APP; \
+ $(PYTHON) ./manage.py makemigrations $$APP; \
+ done
+
migrate: ## migrate database
cd $(project); $(PYTHON) manage.py migrate
+collectstatic: ## collect all static files
+ cd $(project);$(PYTHON) manage.py collectstatic --noinput
+
+makemessages: ## generate translation messages
+ cd $(CURDIR); \
+ $(PYTHON) $(project)/manage.py makemessages --all; \
+ #msgfilter -i locale/fr/LC_MESSAGES/django.po sed -e d | sed -e "s/fuzzy//g" > locale/django.pot ;\
+
compilemessages: ## compile translations
cd $(CURDIR); \
$(PYTHON) $(project)/manage.py compilemessages; \
-collectstatic: ## collect all static files
- cd $(project);$(PYTHON) manage.py collectstatic --noinput
+build_doc_values:
+ cd $(project);\
+ echo 'exec(open("../docs/generate_values_doc.py").read())' | $(PYTHON) ./manage.py shell
-##@ Development: build/tests
+build_doc_model_graph:
+ cd $(project);\
+ echo 'exec(open("../docs/generate_values_doc.py").read())' | $(PYTHON) ./manage.py shell
+ cd $(project);\
+ $(PYTHON) manage.py graph_models --pydot -g -I "ImporterModel,ImporterType,ImporterDefault,ImporterDefaultValues,ImporterColumn,Regexp,ImportTarget,FormaterType,Import" ishtar_common > /tmp/ishtar-imports.dot ;\
+ dot -Tsvg /tmp/ishtar-imports.dot -o ../docs/source/_static/db-imports.svg
+ rm /tmp/ishtar-imports.dot
+ cd $(project);\
+ for APP in $(apps); do \
+ $(PYTHON) manage.py graph_models -g --pydot $$APP > /tmp/ishtar-$$APP.dot; \
+ dot -Tsvg /tmp/ishtar-$$APP.dot -o ../docs/source/_static/db-$$APP.svg; \
+ rm /tmp/ishtar-$$APP.dot ; \
+ done
+
+build_doc: build_doc_values build_doc_model_graph ## generate documentation
+
+##@ Development: tests
test: clean ## launch tests
cd $(project); $(PYTHON) manage.py test $(apps)
@@ -48,6 +80,9 @@ test: clean ## launch tests
soft_test: clean ## launch tests without database regeneration
cd $(project); $(PYTHON) manage.py test -k $(apps)
+soft_test_verbose: clean ## launch tests without database regeneration - verbose
+ cd $(project); $(PYTHON) manage.py test -k --verbosity 2 $(apps)
+
build_gitlab: clean collectstatic ## specific build for gitlab
cd $(project); $(PYTHON) ./manage.py migrate
@@ -74,45 +109,15 @@ pylint:
##@ Development: run
-shell:
+shell: ## launch shell
cd $(project);$(PYTHON) manage.py shell
run: ## run test server
cd $(project); $(PYTHON) manage.py runserver 0.0.0.0:8000
-runcelery:
+runcelery: ## run a celery worker
celery -A example_project worker -l info
-##@ Development: translations
-
-makemessages:
- cd $(CURDIR); \
- $(PYTHON) $(project)/manage.py makemessages --all; \
- #msgfilter -i locale/fr/LC_MESSAGES/django.po sed -e d | sed -e "s/fuzzy//g" > locale/django.pot ;\
-
-##@ Development: database
-
-migrations:
- cd $(project);\
- for APP in "overload_translation" $(apps); do \
- echo "* makemigrations for "$$APP; \
- $(PYTHON) ./manage.py makemigrations $$APP; \
- done
-
-generate_doc:
- cd $(project);\
- echo 'exec(open("../docs/generate_values_doc.py").read())' | $(PYTHON) ./manage.py shell
- cd $(project);\
- $(PYTHON) manage.py graph_models --pydot -g -I "ImporterModel,ImporterType,ImporterDefault,ImporterDefaultValues,ImporterColumn,Regexp,ImportTarget,FormaterType,Import" ishtar_common > /tmp/ishtar-imports.dot ;\
- dot -Tsvg /tmp/ishtar-imports.dot -o ../docs/source/_static/db-imports.svg
- rm /tmp/ishtar-imports.dot
- cd $(project);\
- for APP in $(apps); do \
- $(PYTHON) manage.py graph_models -g --pydot $$APP > /tmp/ishtar-$$APP.dot; \
- dot -Tsvg /tmp/ishtar-$$APP.dot -o ../docs/source/_static/db-$$APP.svg; \
- rm /tmp/ishtar-$$APP.dot ; \
- done
-
##@ Manage fixtures
fixtures: fixtures_auth fixtures_common fixtures_operations fixtures_context_records fixtures_finds fixtures_warehouse fixtures_files
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)