summaryrefslogtreecommitdiff
path: root/archaeological_context_records/models.py
diff options
context:
space:
mode:
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
commite6d28b9a5e69461726a06826cbcf089dfe34f148 (patch)
treec595e4556ff333b80c51e161d6c539d9775cec94 /archaeological_context_records/models.py
parent95145c2b3fb315c9c16aeeccd1e3e1770c9e2f08 (diff)
downloadIshtar-e6d28b9a5e69461726a06826cbcf089dfe34f148.tar.bz2
Ishtar-e6d28b9a5e69461726a06826cbcf089dfe34f148.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.py8
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")