From 0dc5a4607b54a95f0fc04cb0bb20c152180c44ae Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 9 Jul 2019 13:40:04 +0200 Subject: Graph generation: fix non full generation with changing relation type - attach full to upper item --- ishtar_common/utils.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'ishtar_common/utils.py') 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 -- cgit v1.2.3