diff options
Diffstat (limited to 'archaeological_context_records/models.py')
-rw-r--r-- | archaeological_context_records/models.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index d71864302..70858ea31 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -26,6 +26,7 @@ from django.db import connection, transaction from django.db.models import Q from django.db.models.signals import post_delete, post_save from django.utils.translation import ugettext_lazy as _, ugettext, pgettext +from django.utils.text import slugify from ishtar_common.utils import cached_label_changed @@ -215,7 +216,6 @@ class ContextRecord(BulkUpdatedItem, BaseHistorizedItem, ImageModel, OwnPerms, 'related_context_records': 'detailled_related_context_records' } } - IMAGE_PREFIX = 'context_records/' # search parameters EXTRA_REQUEST_KEYS = { @@ -447,6 +447,13 @@ class ContextRecord(BulkUpdatedItem, BaseHistorizedItem, ImageModel, OwnPerms, context_record_id=self.pk) return True + def _get_base_image_path(self): + ope = self.operation + return u"operation/{}/{}/{}/{}".format( + ope.year, ope.reference, self.SLUG, + slugify(self.label or u"00") + ) + @property def reference(self): if not self.operation: @@ -691,3 +698,4 @@ class ContextRecordSource(Source): Q(context_record__operation__collaborators__pk= user.ishtaruser.person.pk)) \ & Q(context_record__operation__end_date__isnull=True) + |