diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-04-23 18:40:47 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-06-12 08:43:58 +0200 |
commit | 8279d1c668a54868e7195d20eb39d1ce4c5a1c06 (patch) | |
tree | c595e4556ff333b80c51e161d6c539d9775cec94 /archaeological_context_records/models.py | |
parent | 349466995516bc0b5eb72f333693ac8dfb5146f2 (diff) | |
download | Ishtar-8279d1c668a54868e7195d20eb39d1ce4c5a1c06.tar.bz2 Ishtar-8279d1c668a54868e7195d20eb39d1ce4c5a1c06.zip |
Images: add a main_image field (refs #4076) - Add images associated to warehouses (refs #3879)
Diffstat (limited to 'archaeological_context_records/models.py')
-rw-r--r-- | archaeological_context_records/models.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index f6253bf68..bdb21ea39 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -325,7 +325,7 @@ class ContextRecord(BulkUpdatedItem, BaseHistorizedItem, point = models.PointField(_(u"Point (3D)"), blank=True, null=True, dim=3) polygon = models.PolygonField(_(u"Polygon"), blank=True, null=True) images = models.ManyToManyField(IshtarImage, verbose_name=_(u"Images"), - blank=True) + blank=True, through='ContextRecordImage') cached_label = models.TextField(_(u"Cached name"), null=True, blank=True, db_index=True) PARENT_SEARCH_VECTORS = ['operation'] @@ -565,6 +565,12 @@ class ContextRecord(BulkUpdatedItem, BaseHistorizedItem, post_save.connect(cached_label_changed, sender=ContextRecord) +class ContextRecordImage(models.Model): + image = models.ForeignKey(IshtarImage, on_delete=models.CASCADE) + context_record = models.ForeignKey(ContextRecord, on_delete=models.CASCADE) + is_main = models.BooleanField(_(u"Main image"), default=False) + + class RelationType(GeneralRelationType): class Meta: verbose_name = _(u"Relation type") |