diff options
Diffstat (limited to 'archaeological_finds/models_finds.py')
-rw-r--r-- | archaeological_finds/models_finds.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index d56789d3a..8a942e306 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -334,6 +334,19 @@ class BaseFind(BulkUpdatedItem, BaseHistorizedItem, GeoItem, OwnPerms, def natural_key(self): return (self.external_id, ) + def public_representation(self): + dct = super(BaseFind, self).public_representation() + dct.update({ + "context-record": self.context_record.public_representation(), + "description": self.description, + "comment": self.comment, + "discovery-date": self.discovery_date and + self.discovery_date.strftime("%Y/%m/%d"), + "discovery-date-taq": self.discovery_date_taq, + "discovery-date-tpq": self.discovery_date_tpq, + }) + return dct + def get_values(self, prefix='', no_values=False, no_find=False): values = super(BaseFind, self).get_values(prefix=prefix, no_values=no_values) @@ -1638,6 +1651,35 @@ class Find(BulkUpdatedItem, ValueGetter, DocumentItem, BaseHistorizedItem, def show_url(self): return reverse('show-find', args=[self.pk, '']) + def public_representation(self): + dct = super(Find, self).public_representation() + dct.update({ + "denomination": self.denomination, + "free-id": self.label, + "description": self.description, + "materials": [str(mt) for mt in self.material_types.all()], + "material-comment": self.material_comment, + "object-types": [str(ot) for ot in self.object_types.all()], + "find-number": self.find_number, + "decoration": self.decoration, + "inscription": self.inscription, + "manufacturing-place":self.manufacturing_place, + "comment": self.comment, + "length": self.length, + "width": self.width, + "height": self.height, + "thickness": self.thickness, + "diameter": self.diameter, + "circumference": self.circumference, + "volume": self.volume, + "weight": self.weight, + "datings": [str(dating) for dating in self.datings.all()], + "base-finds": [bf.public_representation() + for bf in self.base_finds.all()] + }) + # images + return dct + @property def name(self): return u" - ".join([base_find.name |