From eac44d3169c682e183d962f99d21a1e44354d37b Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 1 May 2018 20:09:21 +0200 Subject: Display generation button for relation image on the sheet --- ishtar_common/models.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'ishtar_common/models.py') 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) -- cgit v1.2.3