summaryrefslogtreecommitdiff
path: root/archaeological_finds/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2016-12-04 22:21:11 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2016-12-04 22:21:11 +0100
commit73906807255262b09ba4539f959620dc8a405897 (patch)
treeb3f8007c10742fe8b43279c2b4dfcba5da014c71 /archaeological_finds/models.py
parenta9646771435747f4cab26b77f095702f8194d8ce (diff)
downloadIshtar-73906807255262b09ba4539f959620dc8a405897.tar.bz2
Ishtar-73906807255262b09ba4539f959620dc8a405897.zip
Treatments: fix pdf and odt exports
Diffstat (limited to 'archaeological_finds/models.py')
-rw-r--r--archaeological_finds/models.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py
index a563a8404..fc231a16a 100644
--- a/archaeological_finds/models.py
+++ b/archaeological_finds/models.py
@@ -24,6 +24,7 @@ from django.contrib.gis.db import models
from django.core.urlresolvers import reverse
from django.db.models import Max, Q
from django.db.models.signals import m2m_changed, post_save, post_delete
+from django.template.defaultfilters import slugify
from django.utils.translation import ugettext_lazy as _, ugettext
from ishtar_common.utils import cached_label_changed
@@ -856,7 +857,7 @@ class Treatment(BaseHistorizedItem, ImageModel, OwnPerms):
)
def __unicode__(self):
- lbl = unicode(self.treatment_type)
+ lbl = unicode(self.treatment_types_lbl())
if self.person:
lbl += u" %s %s" % (_(u"by"), unicode(self.person))
return lbl
@@ -913,6 +914,12 @@ class Treatment(BaseHistorizedItem, ImageModel, OwnPerms):
find.skip_history_when_saving = True
find.save()
+ @property
+ def associated_filename(self):
+ return "-".join([
+ str(slugify(getattr(self, attr)))
+ for attr in ('year', 'index', 'label')])
+
class AbsFindTreatments(models.Model):
find = models.ForeignKey(Find, verbose_name=_(u"Find"),