diff options
author | QuentinAndre <quentin.andre@imt-atlantique.net> | 2021-07-16 07:27:00 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-09-01 12:36:46 +0200 |
commit | 57cb006e6fcafc67dd4a8423cb3d273bdd14a18b (patch) | |
tree | b1d40ae2741abb87010c5f87bd975e2e260b7d2b /archaeological_operations | |
parent | 35e60eeb73d0b0cdd764b027a44e8515fd69c6c1 (diff) | |
download | Ishtar-57cb006e6fcafc67dd4a8423cb3d273bdd14a18b.tar.bz2 Ishtar-57cb006e6fcafc67dd4a8423cb3d273bdd14a18b.zip |
get_geo_items for operations and tests
Diffstat (limited to 'archaeological_operations')
-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) |