diff options
author | QuentinAndre <quentin.andre@imt-atlantique.net> | 2021-07-16 07:27:00 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-10-25 12:06:02 +0200 |
commit | b7413fe72698e37d281b3507edcb203191ef8f1e (patch) | |
tree | 4d173806a2090d5b57d10dcf6adcbb1365b91bd9 /archaeological_operations/models.py | |
parent | 7329d0deb3b195f68660743f612fc1852f238df2 (diff) | |
download | Ishtar-b7413fe72698e37d281b3507edcb203191ef8f1e.tar.bz2 Ishtar-b7413fe72698e37d281b3507edcb203191ef8f1e.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) |