diff options
| author | QuentinAndre <quentin.andre@imt-atlantique.net> | 2021-07-16 10:25:23 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-07-08 09:58:48 +0200 | 
| commit | 92bd9026e0b6397103da83bffe64f3a53ee06742 (patch) | |
| tree | 46ef9daf4115431ac8ac1cc33f8524a884d89b00 /archaeological_context_records/models.py | |
| parent | 102245e0088963f3f31d41ce086fda0d5d70a05c (diff) | |
| download | Ishtar-92bd9026e0b6397103da83bffe64f3a53ee06742.tar.bz2 Ishtar-92bd9026e0b6397103da83bffe64f3a53ee06742.zip | |
format GeoJSON and getting properly related objects
Diffstat (limited to 'archaeological_context_records/models.py')
| -rw-r--r-- | archaeological_context_records/models.py | 15 | 
1 files changed, 8 insertions, 7 deletions
| diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 0a6544991..db45418b7 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -860,17 +860,18 @@ class ContextRecord(      def get_geo_items(self, get_polygons, rounded=True):          dict = super(ContextRecord, self).get_geo_items(get_polygons, rounded) -        associated_geo_items = {"associated base finds": {}}          BaseFind = apps.get_model("archaeological_finds", "BaseFind") -        for find_label in self._get_associated_cached_labels(): +        collection_base_finds = [] +        for bf in self.base_finds.distinct().all():              try: -                bf = BaseFind.objects.get(label=find_label) -                associated_geo_items["associated base finds"][ -                    str(find_label) -                ] = bf.get_geo_items(get_polygons, rounded) +                geo_item = bf.get_geo_items(get_polygons, rounded) +                collection_base_finds.append(geo_item)              except BaseFind.DoesNotExist:                  pass -        dict["properties"] = associated_geo_items +        dict["properties"]["base-finds"] = { +            "type": "FeatureCollection", +            "features": collection_base_finds, +        }          return dict      @classmethod | 
