diff options
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r-- | archaeological_operations/models.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index a6e55a59e..336a9ca74 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -342,6 +342,24 @@ class ArchaeologicalSite(DocumentItem, BaseHistorizedItem, QRCodeItem, def short_class_name(self): return _("SITE") + def public_representation(self): + dct = super(ArchaeologicalSite, self).public_representation() + dct.update({ + "reference": self.reference, + "name": self.name, + "materials": [str(p) for p in self.periods.all()], + "remains": [str(r) for r in self.remains.all()], + "towns": [t.label_with_areas() for t in self.towns.all()], + "comment": self.comment, + "locality": self.locality_ngi or self.locality_cadastral, + }) + profile = get_current_profile() + if profile.underwater(): + dct["shipwreck-name"] = self.shipwreck_name + dct["sinking-date"] = self.sinking_date + dct["discovery-area"] = self.discovery_area + return dct + @property def finds(self): from archaeological_finds.models import Find @@ -1068,6 +1086,21 @@ class Operation(ClosedItem, DocumentItem, BaseHistorizedItem, QRCodeItem, ] return values + def public_representation(self): + dct = super(Operation, self).public_representation() + dct.update({ + "year": self.year, + "common-name": self.common_name, + "operation-type": self.operation_type and str(self.operation_type), + "remains": [str(r) for r in self.remains.all()], + "periods": [str(p) for p in self.periods.all()], + "excavation-start-date": self.start_date, + "excavation-end-date": self.excavation_end_date, + "address": self.address, + "comment": self.comment, + }) + return dct + @classmethod def _get_department_code(cls, value): if not settings.ISHTAR_DPTS: |