diff options
| 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 | 
| commit | eac44d3169c682e183d962f99d21a1e44354d37b (patch) | |
| tree | 063f1adeb5f768028edbf2c0de1cb30f17de2f8e /ishtar_common/models.py | |
| parent | f8eca001008f0e07c6a2a38e78c1af5db415940a (diff) | |
| download | Ishtar-eac44d3169c682e183d962f99d21a1e44354d37b.tar.bz2 Ishtar-eac44d3169c682e183d962f99d21a1e44354d37b.zip | |
Display generation button for relation image on the sheet
Diffstat (limited to 'ishtar_common/models.py')
| -rw-r--r-- | ishtar_common/models.py | 19 | 
1 files changed, 18 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) | 
