summaryrefslogtreecommitdiff
path: root/archaeological_finds/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds/models.py')
-rw-r--r--archaeological_finds/models.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py
index 1d59c59b1..a2cea7ef3 100644
--- a/archaeological_finds/models.py
+++ b/archaeological_finds/models.py
@@ -204,7 +204,7 @@ WEIGHT_UNIT = (('g', _(u"g")),
class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):
- TABLE_COLS = ['label', 'material_types', 'dating.period',
+ TABLE_COLS = ['label', 'material_types', 'datings.period',
'base_finds.context_record.parcel.town',
'base_finds.context_record.operation.year',
'base_finds.context_record.operation.operation_code',
@@ -232,7 +232,7 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):
'index']
TABLE_COLS_FOR_OPE += [
'previous_id', 'label', 'material_types',
- 'dating.period', 'find_number', 'object_types',
+ 'datings.period', 'find_number', 'object_types',
'description']
TABLE_COLS_FOR_OPE_LBL = {
@@ -265,8 +265,8 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):
downstream_treatment = models.ForeignKey(
"Treatment", blank=True, null=True, related_name='upstream_treatment',
verbose_name=_("Downstream treatment"))
- dating = models.ForeignKey(Dating, verbose_name=_(u"Dating"), blank=True,
- null=True)
+ datings = models.ManyToManyField(Dating, verbose_name=_(u"Dating"),
+ related_name='find')
if WAREHOUSE_AVAILABLE:
container = models.ForeignKey(
Container, verbose_name=_(u"Container"), blank=True, null=True,
@@ -315,6 +315,10 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):
return self.reference
@property
+ def dating(self):
+ return u" ; ".join([unicode(dating) for dating in self.datings.all()])
+
+ @property
def show_url(self):
return reverse('show-find', args=[self.pk, ''])