summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-05-01 20:09:21 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-06-12 08:43:58 +0200
commit4eb4708ec5358a2c2f069c58aa3284320242d026 (patch)
tree063f1adeb5f768028edbf2c0de1cb30f17de2f8e /ishtar_common
parenteb599665e28f5800d9d5abe3551933e3f6b0507f (diff)
downloadIshtar-4eb4708ec5358a2c2f069c58aa3284320242d026.tar.bz2
Ishtar-4eb4708ec5358a2c2f069c58aa3284320242d026.zip
Display generation button for relation image on the sheet
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/models.py19
-rw-r--r--ishtar_common/views.py1
2 files changed, 19 insertions, 1 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index cbf1431a7..4d8243af4 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -62,7 +62,8 @@ from simple_history.models import HistoricalRecords as BaseHistoricalRecords
from ishtar_common.model_merging import merge_model_objects
from ishtar_common.utils import get_cache, disable_for_loaddata, create_slug,\
- get_all_field_names, merge_tsvectors, cached_label_changed
+ get_all_field_names, merge_tsvectors, cached_label_changed, \
+ generate_relation_graph
from ishtar_common.models_imports import ImporterModel, ImporterType, \
ImporterDefault, ImporterDefaultValues, ImporterColumn, \
@@ -984,6 +985,22 @@ class BulkUpdatedItem(object):
return transaction_id, False
+class RelationItem(models.Model):
+ """
+ Items with relation between them
+ """
+ relation_image = models.FileField(
+ _(u"Generated relation image (SVG)"), null=True, blank=True,
+ upload_to=get_image_path
+ )
+
+ class Meta:
+ abstract = True
+
+ def generate_relation_image(self):
+ generate_relation_graph(self)
+
+
class JsonDataSection(models.Model):
content_type = models.ForeignKey(ContentType)
name = models.CharField(_(u"Name"), max_length=200)
diff --git a/ishtar_common/views.py b/ishtar_common/views.py
index 945d4764c..f6468afd0 100644
--- a/ishtar_common/views.py
+++ b/ishtar_common/views.py
@@ -1353,6 +1353,7 @@ def show_item(model, name, extra_dct=None):
).split('/')[:-2]) + u"/"
dct['CURRENCY'] = get_current_profile().currency
dct['ENCODING'] = settings.ENCODING
+ dct['DOT_GENERATION'] = settings.DOT_BINARY and True
dct['current_window_url'] = url_name
date = None
if 'date' in dct: