diff options
Diffstat (limited to 'archaeological_finds/models_finds.py')
-rw-r--r-- | archaeological_finds/models_finds.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 69d9e92bf..ad9e2a822 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -1572,15 +1572,15 @@ class Find(BulkUpdatedItem, ValueGetter, DocumentItem, BaseHistorizedItem, help_text=_(u"Related treatments when no new find is created")) cached_label = models.TextField(_(u"Cached name"), null=True, blank=True, db_index=True) - cached_periods = models.TextField( + cached_periods = models.TextField( _("Cached periods label"), blank=True, null=True, help_text=_("Generated automatically - do not edit") ) - cached_object_types = models.TextField( + cached_object_types = models.TextField( _("Cached object types label"), blank=True, null=True, help_text=_("Generated automatically - do not edit") ) - cached_materials = models.TextField( + cached_materials = models.TextField( _("Cached material types label"), blank=True, null=True, help_text=_("Generated automatically - do not edit") ) @@ -1953,6 +1953,16 @@ class Find(BulkUpdatedItem, ValueGetter, DocumentItem, BaseHistorizedItem, return Find.objects.filter(pk=self.pk).values( 'cached_label')[0]['cached_label'] + def _generate_cached_periods(self): + return " & ".join([dating.period.label + for dating in self.datings.all()]) + + def _generate_cached_object_types(self): + return " & ".join([str(obj) for obj in self.object_types.all()]) + + def _generate_cached_materials(self): + return " & ".join([str(mat) for mat in self.material_types.all()]) + @classmethod def cached_label_bulk_update( cls, operation_id=None, parcel_id=None, context_record_id=None, |