diff options
author | QuentinAndre <quentin.andre@imt-atlantique.net> | 2021-07-16 07:27:00 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-11-16 17:04:41 +0100 |
commit | dc3d649e092fc232a9db07e5883015868f896140 (patch) | |
tree | 98aaff16a1846a250fb03211ff8e2f672fbb1370 /archaeological_operations/models.py | |
parent | 847d8e95b1e896170bb5dc08d54eb64370b50bfd (diff) | |
download | Ishtar-dc3d649e092fc232a9db07e5883015868f896140.tar.bz2 Ishtar-dc3d649e092fc232a9db07e5883015868f896140.zip |
get_geo_items for operations and tests
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r-- | archaeological_operations/models.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index f1368abc2..29b3eac91 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -1608,19 +1608,24 @@ class Operation( 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(): + ContextRecord = apps.get_model( + "archaeological_context_records", "ContextRecord" + ) + for ( + cr + ) in ( + self._get_associated_cached_labels() + ): # malgré le nom, ce ne sont pas des labels ? try: - cr = ContextRecord.objects.get(label=label) associated_geo_items["associated context records"][ - str(label) + str(cr.label) ] = cr.get_geo_items(get_polygons, rounded) except ContextRecord.DoesNotExist: + print("except") pass dict["properties"] = associated_geo_items return dict - def context_record_relations_q(self): from archaeological_context_records.models import RecordRelations as CRRL @@ -2795,8 +2800,11 @@ class Parcel(LightHistorizedItem): @property def short_label(self): - items = [str(item) for item in [self.section, self.parcel_number, self.address] - if item] + items = [ + str(item) + for item in [self.section, self.parcel_number, self.address] + if item + ] if self.public_domain: items.append(str(_("Public domain"))) return settings.JOINT.join(items) |