From 35e60eeb73d0b0cdd764b027a44e8515fd69c6c1 Mon Sep 17 00:00:00 2001 From: QuentinAndre Date: Thu, 15 Jul 2021 18:05:13 +0200 Subject: better tests and beginning operations --- archaeological_operations/models.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'archaeological_operations') diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index a49504506..f1368abc2 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 -- cgit v1.2.3