diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-03-23 13:57:12 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-03-27 17:53:27 +0200 |
commit | e59f196291ccc90b05091737d906efe6b2ab10cd (patch) | |
tree | 01b5c73a9810b80b8841b33f046adc21495e77ab /ishtar_common/utils.py | |
parent | 8ecaa38cf67db0a9d3bc1514c08c5ad19456a8e2 (diff) | |
download | Ishtar-e59f196291ccc90b05091737d906efe6b2ab10cd.tar.bz2 Ishtar-e59f196291ccc90b05091737d906efe6b2ab10cd.zip |
Step by step: large improvments on step display (refs #3975)
Show modified, sheet access for existing items, link between created,
updated fields and associated column.
Diffstat (limited to 'ishtar_common/utils.py')
-rw-r--r-- | ishtar_common/utils.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index 948604c16..5a03f7f5f 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -396,3 +396,19 @@ def get_session_var(session_key, key): if key not in session: return return session[key] + + +def get_field_labels_from_path(model, path): + """ + :param model: base model + :param path: list of attribute starting from the base model + :return: list of labels + """ + labels = [] + for key in path: + field = model._meta.get_field(key) + if hasattr(field, 'verbose_name'): + labels.append(field.verbose_name) + if field.one_to_many or field.one_to_one or field.many_to_many: + model = field.model + return labels |