diff options
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 36f31322e..578f90caa 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 @@ -2810,8 +2815,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) |