diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-07-09 13:40:04 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-07-09 13:40:04 +0200 |
commit | 76b9e9268426812800829a522b3adb89f97a7dc6 (patch) | |
tree | 55798a74a2c603a06fe38cbb6e1ad9d69bf4b9eb /ishtar_common/utils.py | |
parent | 39bb02a38920b1fe0094365e261acd57f814f97d (diff) | |
download | Ishtar-76b9e9268426812800829a522b3adb89f97a7dc6.tar.bz2 Ishtar-76b9e9268426812800829a522b3adb89f97a7dc6.zip |
Graph generation: fix non full generation with changing relation type - attach full to upper item
Diffstat (limited to 'ishtar_common/utils.py')
-rw-r--r-- | ishtar_common/utils.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index ebfbaaa77..eb8414ced 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -1160,18 +1160,16 @@ def get_relations_for_graph(rel_model, obj_pk, above_relations=None, other_record = left_record else: other_record = right_record - - render_bellow = False if get_above and get_bellow and not full and (is_bellow or is_above): - if is_above: + if (is_above and not inverse) or (is_bellow and inverse): ar, er, substyles = get_relations_for_graph( rel_model, other_record, above_relations, equal_relations, treated, styles, render_above=True, render_bellow=False ) - elif is_bellow: + else: ar, er, substyles = get_relations_for_graph( rel_model, other_record, above_relations, equal_relations, treated, styles, @@ -1278,6 +1276,10 @@ def generate_relation_graph(obj, highlight_current=True, else: suffix = "" + if full and obj.MAIN_UP_MODEL_QUERY and getattr(obj, + obj.MAIN_UP_MODEL_QUERY): + obj = getattr(obj, obj.MAIN_UP_MODEL_QUERY) + with open(dot_name, "r") as dot_file: django_file = File(dot_file) attr = "relation_dot" + suffix |