summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/models.py1
-rw-r--r--ishtar_common/utils.py10
2 files changed, 7 insertions, 4 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index b2f235207..872f740e6 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -1201,6 +1201,7 @@ class RelationItem(models.Model):
"""
Items with relation between them
"""
+ MAIN_UP_MODEL_QUERY = ""
relation_image = models.FileField(
_("Generated relation image (SVG)"), null=True, blank=True,
upload_to=get_image_path, help_text=max_size_help()
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