summaryrefslogtreecommitdiff
path: root/archaeological_finds/models_finds.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds/models_finds.py')
-rw-r--r--archaeological_finds/models_finds.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py
index 94a8ccedc..dcf542f79 100644
--- a/archaeological_finds/models_finds.py
+++ b/archaeological_finds/models_finds.py
@@ -35,7 +35,7 @@ from ishtar_common.utils import cached_label_changed, post_save_point
from ishtar_common.models import GeneralType, HierarchicalType, ImageModel, \
BaseHistorizedItem, ShortMenuItem, LightHistorizedItem, \
HistoricalRecords, OwnPerms, Source, Person, Basket, post_save_cache, \
- ValueGetter, get_current_profile, IshtarImage
+ ValueGetter, get_current_profile, IshtarImage, ThroughImage
from archaeological_operations.models import AdministrativeAct, Operation
from archaeological_context_records.models import ContextRecord, Dating
@@ -929,8 +929,8 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, ImageModel,
return u"detached/{}".format(self.SLUG)
ope = bf.context_record.operation
find_idx = u'{:0' + str(settings.ISHTAR_FINDS_INDEX_ZERO_LEN) + 'd}'
- return (u"operation/{}/{}/{}/" + find_idx).format(
- ope.year, ope.reference, self.SLUG, self.index)
+ return (u"{}/{}/" + find_idx).format(
+ ope._get_base_image_path(), self.SLUG, self.index)
@property
def administrative_index(self):
@@ -1433,10 +1433,9 @@ def base_find_find_changed(sender, **kwargs):
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 FindImage(ThroughImage):
+ item = models.ForeignKey(Find, on_delete=models.CASCADE,
+ related_name='associated_images')
class FindSource(Source):