diff options
Diffstat (limited to 'archaeological_finds/models_finds.py')
| -rw-r--r-- | archaeological_finds/models_finds.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 40059faa6..94a8ccedc 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -829,7 +829,7 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, ImageModel, appraisal_date = models.DateField(_(u"Appraisal date"), blank=True, null=True) images = models.ManyToManyField(IshtarImage, verbose_name=_(u"Images"), - blank=True) + blank=True, through='FindImage') cached_label = models.TextField(_(u"Cached name"), null=True, blank=True, db_index=True) history = HistoricalRecords() @@ -1429,9 +1429,16 @@ def base_find_find_changed(sender, **kwargs): # recalculate complete id and external id obj.save() + m2m_changed.connect(base_find_find_changed, sender=Find.base_finds.through) +class FindImage(models.Model): + image = models.ForeignKey(IshtarImage, on_delete=models.CASCADE) + treatment = models.ForeignKey(Find, on_delete=models.CASCADE) + is_main = models.BooleanField(_(u"Main image"), default=False) + + class FindSource(Source): SHOW_URL = 'show-findsource' MODIFY_URL = 'find_source_modify' |
