summaryrefslogtreecommitdiff
path: root/archaeological_operations/models.py
diff options
context:
space:
mode:
authorQuentinAndre <quentin.andre@imt-atlantique.net>2021-07-15 18:05:13 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-07-08 09:58:48 +0200
commit388a4c654b16fb51901796708f5138bbccd6adc6 (patch)
treee6bb7a04180a078c530a01db55bdc7facb322205 /archaeological_operations/models.py
parent29aae0276343bae44470b6e926d57b04ac431ea2 (diff)
downloadIshtar-388a4c654b16fb51901796708f5138bbccd6adc6.tar.bz2
Ishtar-388a4c654b16fb51901796708f5138bbccd6adc6.zip
better tests and beginning operations
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r--archaeological_operations/models.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 05c1d6336..36f31322e 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -1605,6 +1605,22 @@ class Operation(
return None
return q.all()[0].poly, self._meta.verbose_name
+ def get_geo_items(self, get_polygons, rounded=True):
+ dict = super(Operation, self).get_geo_items(get_polygons, rounded)
+ associated_geo_items = {"associated context records": {}}
+ ContextRecord = apps.get_model("archaeological_context_records", "ContextRecord")
+ for label in self._get_associated_cached_labels():
+ try:
+ cr = ContextRecord.objects.get(label=label)
+ associated_geo_items["associated context records"][
+ str(label)
+ ] = cr.get_geo_items(get_polygons, rounded)
+ except ContextRecord.DoesNotExist:
+ pass
+ dict["properties"] = associated_geo_items
+ return dict
+
+
def context_record_relations_q(self):
from archaeological_context_records.models import RecordRelations as CRRL