diff options
| author | Quentin André <quentin.andre@imt-atlantique.net> | 2021-07-16 07:27:00 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-07-08 09:58:48 +0200 | 
| commit | db7c86bda1e153c410faedb1b61b59acb353969d (patch) | |
| tree | 41991f0b06b675dabb87544f70a163c5bd5f0e7a /archaeological_operations/models.py | |
| parent | 4da8517599a8941fd622bb8b152db590ec0e543a (diff) | |
| download | Ishtar-db7c86bda1e153c410faedb1b61b59acb353969d.tar.bz2 Ishtar-db7c86bda1e153c410faedb1b61b59acb353969d.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 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) | 
