From 46e09a8d5a0d6d80ed07bd3a7c9bcb3437321595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20Bouttier?= Date: Fri, 4 Oct 2024 11:50:00 +0200 Subject: [PATCH] feat(modules): custom module label --- backend/geonature/utils/module.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/geonature/utils/module.py b/backend/geonature/utils/module.py index dbf0d85691..3f20c504a2 100644 --- a/backend/geonature/utils/module.py +++ b/backend/geonature/utils/module.py @@ -110,6 +110,10 @@ def module_db_upgrade(module_dist, directory=None, sql=False, tag=None, x_arg=[] ).scalar_one_or_none() if module is None: # add module to database + try: + module_label = module_dist.entry_points["label"].load() + except KeyError: + module_label = module_code.capitalize() try: module_picto = module_dist.entry_points["picto"].load() except KeyError: @@ -125,7 +129,7 @@ def module_db_upgrade(module_dist, directory=None, sql=False, tag=None, x_arg=[] module = TModules( type=module_type, module_code=module_code, - module_label=module_code.capitalize(), + module_label=module_label, module_path=module_code.lower(), module_target="_self", module_picto=module_picto,