From 96e86690e3e18a046e03ce7b132a6fba86662c17 Mon Sep 17 00:00:00 2001 From: finnus <40977905+finnus@users.noreply.github.com> Date: Wed, 24 May 2023 14:01:52 +0200 Subject: [PATCH 01/27] add optional model for map layers --- django_mapengine/views.py | 45 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/django_mapengine/views.py b/django_mapengine/views.py index ba1a62e..aa68925 100644 --- a/django_mapengine/views.py +++ b/django_mapengine/views.py @@ -1,9 +1,10 @@ """Views and mixins in order to use mapengine""" - +from django.apps import apps from django.conf import settings from django.http import JsonResponse from django.views.generic.base import ContextMixin +from django.core.exceptions import FieldDoesNotExist from . import __version__, layers, sources @@ -65,6 +66,48 @@ def get_context_data(self, **kwargs) -> dict: "choropleths": {choropleth.name: choropleth.as_dict() for choropleth in settings.MAP_ENGINE_CHOROPLETHS}, } + if settings.MAP_ENGINE_MAPLAYER_MODEL: + # get MapLayerModel from settings + try: + MapLayerModel = apps.get_model(app_label='map', model_name=settings.MAP_ENGINE_MAPLAYER_MODEL) + except ImportError: + raise LookupError("The MapLayerModel does not exist.") + + # get choropleth fields + try: + model_field = MapLayerModel._meta.get_field("choropleth_field") + except FieldDoesNotExist: + raise LookupError("Your MapLayerModel has no field named 'choropleth_field', which is mandatory.") + choropleths = MapLayerModel.objects.filter(choropleth_field__isnull=False).values_list("identifier", + "geom_layer") + store["choropleths"] = { + item[0]: {'layers': [item[1]], 'useFeatureState': True} + for item in choropleths + } + + # get popups + try: + model_field = MapLayerModel._meta.get_field("popup_fields") + except FieldDoesNotExist: + raise LookupError("Your MapLayerModel has no field named 'popup_fields', which is mandatory.") + + popups = MapLayerModel.objects.filter(popup_fields__isnull=False).values_list("identifier", "geom_layer") + transformed_popups = {} + for item in popups: + layer_id = item[1] + choropleth = item[0] + + if layer_id not in transformed_popups: + transformed_popups[layer_id] = { + 'layerID': layer_id, + 'atDefaultLayer': False, + 'choropleths': [] + } + + transformed_popups[layer_id]['choropleths'].append(choropleth) + + store["popups"] = transformed_popups + context["mapengine_store_cold_init"] = store return context From 96d26dfdb60a11d9d1f343ad9cf1dc81474b8ad0 Mon Sep 17 00:00:00 2001 From: finnus <40977905+finnus@users.noreply.github.com> Date: Tue, 30 May 2023 11:00:35 +0200 Subject: [PATCH 02/27] add unit and name to choropleths --- django_mapengine/views.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/django_mapengine/views.py b/django_mapengine/views.py index aa68925..818be53 100644 --- a/django_mapengine/views.py +++ b/django_mapengine/views.py @@ -78,10 +78,15 @@ def get_context_data(self, **kwargs) -> dict: model_field = MapLayerModel._meta.get_field("choropleth_field") except FieldDoesNotExist: raise LookupError("Your MapLayerModel has no field named 'choropleth_field', which is mandatory.") - choropleths = MapLayerModel.objects.filter(choropleth_field__isnull=False).values_list("identifier", - "geom_layer") + choropleths = MapLayerModel.objects.filter(choropleth_field__isnull=False).values_list( + "identifier", "geom_layer", "choropleth_unit", "name") store["choropleths"] = { - item[0]: {'layers': [item[1]], 'useFeatureState': True} + item[0]: { + 'layers': [item[1]], + 'useFeatureState': True, + 'unit': [item[2]], + 'name': [item[3]] + } for item in choropleths } From 43f8d9ebf2c949d70939b16c09758bd23d29f467 Mon Sep 17 00:00:00 2001 From: JOSEPHINE STOLLE Date: Tue, 30 May 2023 11:25:28 +0200 Subject: [PATCH 03/27] read legend name and unit from map_store --- django_mapengine/static/django_mapengine/js/legend.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/django_mapengine/static/django_mapengine/js/legend.js b/django_mapengine/static/django_mapengine/js/legend.js index 090ee1d..81b1eba 100644 --- a/django_mapengine/static/django_mapengine/js/legend.js +++ b/django_mapengine/static/django_mapengine/js/legend.js @@ -38,7 +38,8 @@ const createLegend = (title, unit, colors, valueRanges, nextColumnStartIndex = 3 function loadLegend(msg, choroplethName){ - const unit = "unit"; //need value! + const title = map_store.cold.choropleths[choroplethName]["name"]; + const unit = map_store.cold.choropleths[choroplethName]["unit"]; const paintPropertiesPerLayer = map_store.cold.storedChoroplethPaintProperties[choroplethName]; /* Find active layer */ @@ -75,6 +76,6 @@ function loadLegend(msg, choroplethName){ } } const entriesPerColumn = Math.floor(values.length / 2); - legendElement.innerHTML = createLegend(choroplethName, unit, colors, values, entriesPerColumn); + legendElement.innerHTML = createLegend(title, unit, colors, values, entriesPerColumn); return logMessage(msg); } From 26ddf2ec954641430a9ca6ca92a49d7eec61eada Mon Sep 17 00:00:00 2001 From: finnus <40977905+finnus@users.noreply.github.com> Date: Thu, 1 Jun 2023 10:57:41 +0200 Subject: [PATCH 04/27] change layer order to show clusters on top of other layers --- django_mapengine/layers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django_mapengine/layers.py b/django_mapengine/layers.py index b39efcb..d9b8fa2 100644 --- a/django_mapengine/layers.py +++ b/django_mapengine/layers.py @@ -271,8 +271,8 @@ def get_all_layers() -> List[MapLayer]: """ # Order is important! Last items are shown on top! layers = list(get_region_layers()) - for cluster_layer in get_cluster_layers(): - layers.extend(cluster_layer.get_map_layers()) for static_layer in get_static_layers(): layers.extend(static_layer.get_map_layers()) + for cluster_layer in get_cluster_layers(): + layers.extend(cluster_layer.get_map_layers()) return layers From 56b7cdf201b4c08083afaaa019309527a6e7c65e Mon Sep 17 00:00:00 2001 From: finnus <40977905+finnus@users.noreply.github.com> Date: Thu, 1 Jun 2023 11:04:58 +0200 Subject: [PATCH 05/27] exclude blank choropleth_field --- django_mapengine/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_mapengine/views.py b/django_mapengine/views.py index 818be53..43960a2 100644 --- a/django_mapengine/views.py +++ b/django_mapengine/views.py @@ -78,7 +78,7 @@ def get_context_data(self, **kwargs) -> dict: model_field = MapLayerModel._meta.get_field("choropleth_field") except FieldDoesNotExist: raise LookupError("Your MapLayerModel has no field named 'choropleth_field', which is mandatory.") - choropleths = MapLayerModel.objects.filter(choropleth_field__isnull=False).values_list( + choropleths = MapLayerModel.objects.exclude(choropleth_field="").filter(choropleth_field__isnull=False).values_list( "identifier", "geom_layer", "choropleth_unit", "name") store["choropleths"] = { item[0]: { From ad42c41e164f7d3d925583a63ab018718901e30f Mon Sep 17 00:00:00 2001 From: finnus <40977905+finnus@users.noreply.github.com> Date: Wed, 24 May 2023 14:01:52 +0200 Subject: [PATCH 06/27] add optional model for map layers --- django_mapengine/views.py | 45 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/django_mapengine/views.py b/django_mapengine/views.py index ba1a62e..aa68925 100644 --- a/django_mapengine/views.py +++ b/django_mapengine/views.py @@ -1,9 +1,10 @@ """Views and mixins in order to use mapengine""" - +from django.apps import apps from django.conf import settings from django.http import JsonResponse from django.views.generic.base import ContextMixin +from django.core.exceptions import FieldDoesNotExist from . import __version__, layers, sources @@ -65,6 +66,48 @@ def get_context_data(self, **kwargs) -> dict: "choropleths": {choropleth.name: choropleth.as_dict() for choropleth in settings.MAP_ENGINE_CHOROPLETHS}, } + if settings.MAP_ENGINE_MAPLAYER_MODEL: + # get MapLayerModel from settings + try: + MapLayerModel = apps.get_model(app_label='map', model_name=settings.MAP_ENGINE_MAPLAYER_MODEL) + except ImportError: + raise LookupError("The MapLayerModel does not exist.") + + # get choropleth fields + try: + model_field = MapLayerModel._meta.get_field("choropleth_field") + except FieldDoesNotExist: + raise LookupError("Your MapLayerModel has no field named 'choropleth_field', which is mandatory.") + choropleths = MapLayerModel.objects.filter(choropleth_field__isnull=False).values_list("identifier", + "geom_layer") + store["choropleths"] = { + item[0]: {'layers': [item[1]], 'useFeatureState': True} + for item in choropleths + } + + # get popups + try: + model_field = MapLayerModel._meta.get_field("popup_fields") + except FieldDoesNotExist: + raise LookupError("Your MapLayerModel has no field named 'popup_fields', which is mandatory.") + + popups = MapLayerModel.objects.filter(popup_fields__isnull=False).values_list("identifier", "geom_layer") + transformed_popups = {} + for item in popups: + layer_id = item[1] + choropleth = item[0] + + if layer_id not in transformed_popups: + transformed_popups[layer_id] = { + 'layerID': layer_id, + 'atDefaultLayer': False, + 'choropleths': [] + } + + transformed_popups[layer_id]['choropleths'].append(choropleth) + + store["popups"] = transformed_popups + context["mapengine_store_cold_init"] = store return context From 37046ab199302aea9bc1b6dcaa51d5b63212c19f Mon Sep 17 00:00:00 2001 From: finnus <40977905+finnus@users.noreply.github.com> Date: Tue, 30 May 2023 11:00:35 +0200 Subject: [PATCH 07/27] add unit and name to choropleths --- django_mapengine/views.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/django_mapengine/views.py b/django_mapengine/views.py index aa68925..818be53 100644 --- a/django_mapengine/views.py +++ b/django_mapengine/views.py @@ -78,10 +78,15 @@ def get_context_data(self, **kwargs) -> dict: model_field = MapLayerModel._meta.get_field("choropleth_field") except FieldDoesNotExist: raise LookupError("Your MapLayerModel has no field named 'choropleth_field', which is mandatory.") - choropleths = MapLayerModel.objects.filter(choropleth_field__isnull=False).values_list("identifier", - "geom_layer") + choropleths = MapLayerModel.objects.filter(choropleth_field__isnull=False).values_list( + "identifier", "geom_layer", "choropleth_unit", "name") store["choropleths"] = { - item[0]: {'layers': [item[1]], 'useFeatureState': True} + item[0]: { + 'layers': [item[1]], + 'useFeatureState': True, + 'unit': [item[2]], + 'name': [item[3]] + } for item in choropleths } From 5809def07c2efeb5971759ab0558827ae1ff5889 Mon Sep 17 00:00:00 2001 From: finnus <40977905+finnus@users.noreply.github.com> Date: Thu, 1 Jun 2023 10:57:41 +0200 Subject: [PATCH 08/27] change layer order to show clusters on top of other layers --- django_mapengine/layers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django_mapengine/layers.py b/django_mapengine/layers.py index b39efcb..d9b8fa2 100644 --- a/django_mapengine/layers.py +++ b/django_mapengine/layers.py @@ -271,8 +271,8 @@ def get_all_layers() -> List[MapLayer]: """ # Order is important! Last items are shown on top! layers = list(get_region_layers()) - for cluster_layer in get_cluster_layers(): - layers.extend(cluster_layer.get_map_layers()) for static_layer in get_static_layers(): layers.extend(static_layer.get_map_layers()) + for cluster_layer in get_cluster_layers(): + layers.extend(cluster_layer.get_map_layers()) return layers From d6dd9639e9e3be6d162e7d0d6be90539e1fdcb6c Mon Sep 17 00:00:00 2001 From: finnus <40977905+finnus@users.noreply.github.com> Date: Thu, 1 Jun 2023 11:04:58 +0200 Subject: [PATCH 09/27] exclude blank choropleth_field --- django_mapengine/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_mapengine/views.py b/django_mapengine/views.py index 818be53..43960a2 100644 --- a/django_mapengine/views.py +++ b/django_mapengine/views.py @@ -78,7 +78,7 @@ def get_context_data(self, **kwargs) -> dict: model_field = MapLayerModel._meta.get_field("choropleth_field") except FieldDoesNotExist: raise LookupError("Your MapLayerModel has no field named 'choropleth_field', which is mandatory.") - choropleths = MapLayerModel.objects.filter(choropleth_field__isnull=False).values_list( + choropleths = MapLayerModel.objects.exclude(choropleth_field="").filter(choropleth_field__isnull=False).values_list( "identifier", "geom_layer", "choropleth_unit", "name") store["choropleths"] = { item[0]: { From b0edbe250158a5d1e6ecee0aff8a65993aeb89bf Mon Sep 17 00:00:00 2001 From: "RL-INSTITUT\\hendrik.huyskens" Date: Mon, 12 Jun 2023 16:30:41 +0200 Subject: [PATCH 10/27] Chart options are read from popup data and not modified in JS --- CHANGELOG.md | 4 + .../static/django_mapengine/js/popup.js | 74 +------------------ 2 files changed, 5 insertions(+), 73 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06e681d..9178890 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and the versioning aim to respect [Semantic Versioning](http://semver.org/spec/v Here is a template for new release sections +## [0.10.0] - 2023-06-12 +### Changed +- chart options are taken from backend; no frontend modifications + ## [0.9.0] - 2023-06-09 ### Added - title and unit for choropleths in legend diff --git a/django_mapengine/static/django_mapengine/js/popup.js b/django_mapengine/static/django_mapengine/js/popup.js index 24aae15..d2719cc 100644 --- a/django_mapengine/static/django_mapengine/js/popup.js +++ b/django_mapengine/static/django_mapengine/js/popup.js @@ -62,82 +62,10 @@ function add_popup(layerID) { popup.innerHTML = html; if ("chart" in data) { - // Chart Title - const {chart: {title}} = data; - // Chart const chartElement = popup.querySelector("#js-popup__chart"); const chart = echarts.init(chartElement, null, {renderer: 'svg'}); - // TODO: use lookup property in payload to construct chart dynamically. For now we assume bar chart type. - // TODO: In this fetch we always expect one payload item. Make failsafe. - const {chart: {series}} = data; - const xAxisData = createListByName("key", series[0].data); - const yAxisData = createListByName("value", series[0].data); - const option = { - title: { - text: title, - textStyle: { - color: '#002E50', - fontSize: 14, - fontWeight: 400, - lineHeight: 16 - }, - left: 'center' - }, - animation: false, - tooltip: { - trigger: 'axis', - axisPointer: { - type: 'shadow' - } - }, - grid: { - left: 16, - right: 0, - bottom: 32, - top: 48, - containLabel: true - }, - textStyle: { - color: '#002E50' - }, - xAxis: [{ - type: 'category', - data: xAxisData, - axisTick: { - show: false - }, - axisLine: { - show: true, - lineStyle: { - color: '#ECF2F6' - } - }, - }], - yAxis: [{ - type: 'value', - splitLine: { - show: true, - lineStyle: { - color: '#ECF2F6' - } - } - }], - series: [{ - name: 'Direct', - type: 'line', - symbol: 'circle', - symbolSize: 6, - data: yAxisData, - lineStyle: { - color: '#002E50' - }, - itemStyle: { - color: '#002E50' - } - }] - }; - chart.setOption(option); + chart.setOption(data.chart); } requestAnimationFrame(() => { From cda3dfd72949f7c23260b99f2cb78cc38a757a93 Mon Sep 17 00:00:00 2001 From: "RL-INSTITUT\\hendrik.huyskens" Date: Mon, 12 Jun 2023 16:31:16 +0200 Subject: [PATCH 11/27] Update version to v0.10.0 --- django_mapengine/__init__.py | 2 +- poetry.lock | 247 ++++++++++++++++++----------------- pyproject.toml | 2 +- 3 files changed, 130 insertions(+), 121 deletions(-) diff --git a/django_mapengine/__init__.py b/django_mapengine/__init__.py index 7ed9c4f..1b9e2c3 100644 --- a/django_mapengine/__init__.py +++ b/django_mapengine/__init__.py @@ -1,3 +1,3 @@ """Map Engine init, holds version""" -__version__ = "0.9.0" +__version__ = "0.10.0" diff --git a/poetry.lock b/poetry.lock index ecc217a..e03651a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2,52 +2,55 @@ [[package]] name = "asgiref" -version = "3.6.0" +version = "3.7.2" description = "ASGI specs, helper code, and adapters" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "asgiref-3.6.0-py3-none-any.whl", hash = "sha256:71e68008da809b957b7ee4b43dbccff33d1b23519fb8344e33f049897077afac"}, - {file = "asgiref-3.6.0.tar.gz", hash = "sha256:9567dfe7bd8d3c8c892227827c41cce860b368104c3431da67a0c5a65a949506"}, + {file = "asgiref-3.7.2-py3-none-any.whl", hash = "sha256:89b2ef2247e3b562a16eef663bc0e2e703ec6468e2fa8a5cd61cd449786d4f6e"}, + {file = "asgiref-3.7.2.tar.gz", hash = "sha256:9e0ce3aa93a819ba5b45120216b23878cf6e8525eb3848653452b4192b92afed"}, ] +[package.dependencies] +typing-extensions = {version = ">=4", markers = "python_version < \"3.11\""} + [package.extras] tests = ["mypy (>=0.800)", "pytest", "pytest-asyncio"] [[package]] name = "black" -version = "23.1.0" +version = "23.3.0" description = "The uncompromising code formatter." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "black-23.1.0-cp310-cp310-macosx_10_16_arm64.whl", hash = "sha256:b6a92a41ee34b883b359998f0c8e6eb8e99803aa8bf3123bf2b2e6fec505a221"}, - {file = "black-23.1.0-cp310-cp310-macosx_10_16_universal2.whl", hash = "sha256:57c18c5165c1dbe291d5306e53fb3988122890e57bd9b3dcb75f967f13411a26"}, - {file = "black-23.1.0-cp310-cp310-macosx_10_16_x86_64.whl", hash = "sha256:9880d7d419bb7e709b37e28deb5e68a49227713b623c72b2b931028ea65f619b"}, - {file = "black-23.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e6663f91b6feca5d06f2ccd49a10f254f9298cc1f7f49c46e498a0771b507104"}, - {file = "black-23.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:9afd3f493666a0cd8f8df9a0200c6359ac53940cbde049dcb1a7eb6ee2dd7074"}, - {file = "black-23.1.0-cp311-cp311-macosx_10_16_arm64.whl", hash = "sha256:bfffba28dc52a58f04492181392ee380e95262af14ee01d4bc7bb1b1c6ca8d27"}, - {file = "black-23.1.0-cp311-cp311-macosx_10_16_universal2.whl", hash = "sha256:c1c476bc7b7d021321e7d93dc2cbd78ce103b84d5a4cf97ed535fbc0d6660648"}, - {file = "black-23.1.0-cp311-cp311-macosx_10_16_x86_64.whl", hash = "sha256:382998821f58e5c8238d3166c492139573325287820963d2f7de4d518bd76958"}, - {file = "black-23.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2bf649fda611c8550ca9d7592b69f0637218c2369b7744694c5e4902873b2f3a"}, - {file = "black-23.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:121ca7f10b4a01fd99951234abdbd97728e1240be89fde18480ffac16503d481"}, - {file = "black-23.1.0-cp37-cp37m-macosx_10_16_x86_64.whl", hash = "sha256:a8471939da5e824b891b25751955be52ee7f8a30a916d570a5ba8e0f2eb2ecad"}, - {file = "black-23.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8178318cb74f98bc571eef19068f6ab5613b3e59d4f47771582f04e175570ed8"}, - {file = "black-23.1.0-cp37-cp37m-win_amd64.whl", hash = "sha256:a436e7881d33acaf2536c46a454bb964a50eff59b21b51c6ccf5a40601fbef24"}, - {file = "black-23.1.0-cp38-cp38-macosx_10_16_arm64.whl", hash = "sha256:a59db0a2094d2259c554676403fa2fac3473ccf1354c1c63eccf7ae65aac8ab6"}, - {file = "black-23.1.0-cp38-cp38-macosx_10_16_universal2.whl", hash = "sha256:0052dba51dec07ed029ed61b18183942043e00008ec65d5028814afaab9a22fd"}, - {file = "black-23.1.0-cp38-cp38-macosx_10_16_x86_64.whl", hash = "sha256:49f7b39e30f326a34b5c9a4213213a6b221d7ae9d58ec70df1c4a307cf2a1580"}, - {file = "black-23.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:162e37d49e93bd6eb6f1afc3e17a3d23a823042530c37c3c42eeeaf026f38468"}, - {file = "black-23.1.0-cp38-cp38-win_amd64.whl", hash = "sha256:8b70eb40a78dfac24842458476135f9b99ab952dd3f2dab738c1881a9b38b753"}, - {file = "black-23.1.0-cp39-cp39-macosx_10_16_arm64.whl", hash = "sha256:a29650759a6a0944e7cca036674655c2f0f63806ddecc45ed40b7b8aa314b651"}, - {file = "black-23.1.0-cp39-cp39-macosx_10_16_universal2.whl", hash = "sha256:bb460c8561c8c1bec7824ecbc3ce085eb50005883a6203dcfb0122e95797ee06"}, - {file = "black-23.1.0-cp39-cp39-macosx_10_16_x86_64.whl", hash = "sha256:c91dfc2c2a4e50df0026f88d2215e166616e0c80e86004d0003ece0488db2739"}, - {file = "black-23.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2a951cc83ab535d248c89f300eccbd625e80ab880fbcfb5ac8afb5f01a258ac9"}, - {file = "black-23.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:0680d4380db3719ebcfb2613f34e86c8e6d15ffeabcf8ec59355c5e7b85bb555"}, - {file = "black-23.1.0-py3-none-any.whl", hash = "sha256:7a0f701d314cfa0896b9001df70a530eb2472babb76086344e688829efd97d32"}, - {file = "black-23.1.0.tar.gz", hash = "sha256:b0bd97bea8903f5a2ba7219257a44e3f1f9d00073d6cc1add68f0beec69692ac"}, + {file = "black-23.3.0-cp310-cp310-macosx_10_16_arm64.whl", hash = "sha256:0945e13506be58bf7db93ee5853243eb368ace1c08a24c65ce108986eac65915"}, + {file = "black-23.3.0-cp310-cp310-macosx_10_16_universal2.whl", hash = "sha256:67de8d0c209eb5b330cce2469503de11bca4085880d62f1628bd9972cc3366b9"}, + {file = "black-23.3.0-cp310-cp310-macosx_10_16_x86_64.whl", hash = "sha256:7c3eb7cea23904399866c55826b31c1f55bbcd3890ce22ff70466b907b6775c2"}, + {file = "black-23.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:32daa9783106c28815d05b724238e30718f34155653d4d6e125dc7daec8e260c"}, + {file = "black-23.3.0-cp310-cp310-win_amd64.whl", hash = "sha256:35d1381d7a22cc5b2be2f72c7dfdae4072a3336060635718cc7e1ede24221d6c"}, + {file = "black-23.3.0-cp311-cp311-macosx_10_16_arm64.whl", hash = "sha256:a8a968125d0a6a404842fa1bf0b349a568634f856aa08ffaff40ae0dfa52e7c6"}, + {file = "black-23.3.0-cp311-cp311-macosx_10_16_universal2.whl", hash = "sha256:c7ab5790333c448903c4b721b59c0d80b11fe5e9803d8703e84dcb8da56fec1b"}, + {file = "black-23.3.0-cp311-cp311-macosx_10_16_x86_64.whl", hash = "sha256:a6f6886c9869d4daae2d1715ce34a19bbc4b95006d20ed785ca00fa03cba312d"}, + {file = "black-23.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6f3c333ea1dd6771b2d3777482429864f8e258899f6ff05826c3a4fcc5ce3f70"}, + {file = "black-23.3.0-cp311-cp311-win_amd64.whl", hash = "sha256:11c410f71b876f961d1de77b9699ad19f939094c3a677323f43d7a29855fe326"}, + {file = "black-23.3.0-cp37-cp37m-macosx_10_16_x86_64.whl", hash = "sha256:1d06691f1eb8de91cd1b322f21e3bfc9efe0c7ca1f0e1eb1db44ea367dff656b"}, + {file = "black-23.3.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:50cb33cac881766a5cd9913e10ff75b1e8eb71babf4c7104f2e9c52da1fb7de2"}, + {file = "black-23.3.0-cp37-cp37m-win_amd64.whl", hash = "sha256:e114420bf26b90d4b9daa597351337762b63039752bdf72bf361364c1aa05925"}, + {file = "black-23.3.0-cp38-cp38-macosx_10_16_arm64.whl", hash = "sha256:48f9d345675bb7fbc3dd85821b12487e1b9a75242028adad0333ce36ed2a6d27"}, + {file = "black-23.3.0-cp38-cp38-macosx_10_16_universal2.whl", hash = "sha256:714290490c18fb0126baa0fca0a54ee795f7502b44177e1ce7624ba1c00f2331"}, + {file = "black-23.3.0-cp38-cp38-macosx_10_16_x86_64.whl", hash = "sha256:064101748afa12ad2291c2b91c960be28b817c0c7eaa35bec09cc63aa56493c5"}, + {file = "black-23.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:562bd3a70495facf56814293149e51aa1be9931567474993c7942ff7d3533961"}, + {file = "black-23.3.0-cp38-cp38-win_amd64.whl", hash = "sha256:e198cf27888ad6f4ff331ca1c48ffc038848ea9f031a3b40ba36aced7e22f2c8"}, + {file = "black-23.3.0-cp39-cp39-macosx_10_16_arm64.whl", hash = "sha256:3238f2aacf827d18d26db07524e44741233ae09a584273aa059066d644ca7b30"}, + {file = "black-23.3.0-cp39-cp39-macosx_10_16_universal2.whl", hash = "sha256:f0bd2f4a58d6666500542b26354978218a9babcdc972722f4bf90779524515f3"}, + {file = "black-23.3.0-cp39-cp39-macosx_10_16_x86_64.whl", hash = "sha256:92c543f6854c28a3c7f39f4d9b7694f9a6eb9d3c5e2ece488c327b6e7ea9b266"}, + {file = "black-23.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3a150542a204124ed00683f0db1f5cf1c2aaaa9cc3495b7a3b5976fb136090ab"}, + {file = "black-23.3.0-cp39-cp39-win_amd64.whl", hash = "sha256:6b39abdfb402002b8a7d030ccc85cf5afff64ee90fa4c5aebc531e3ad0175ddb"}, + {file = "black-23.3.0-py3-none-any.whl", hash = "sha256:ec751418022185b0c1bb7d7736e6933d40bbb14c14a0abcf9123d1b159f98dd4"}, + {file = "black-23.3.0.tar.gz", hash = "sha256:1c7b8d606e728a41ea1ccbd7264677e494e87cf630e399262ced92d4a8dac940"}, ] [package.dependencies] @@ -67,14 +70,14 @@ uvloop = ["uvloop (>=0.15.2)"] [[package]] name = "certifi" -version = "2022.12.7" +version = "2023.5.7" description = "Python package for providing Mozilla's CA Bundle." category = "main" optional = false python-versions = ">=3.6" files = [ - {file = "certifi-2022.12.7-py3-none-any.whl", hash = "sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18"}, - {file = "certifi-2022.12.7.tar.gz", hash = "sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3"}, + {file = "certifi-2023.5.7-py3-none-any.whl", hash = "sha256:c6c2e98f5c7869efca1f8916fed228dd91539f9f1b444c314c06eef02980c716"}, + {file = "certifi-2023.5.7.tar.gz", hash = "sha256:0f0d56dc5a6ad56fd4ba36484d6cc34451e1c6548c61daad8c320169f91eddc7"}, ] [[package]] @@ -240,14 +243,14 @@ jinja2 = "*" [[package]] name = "django" -version = "3.2.18" +version = "3.2.19" description = "A high-level Python Web framework that encourages rapid development and clean, pragmatic design." category = "main" optional = false python-versions = ">=3.6" files = [ - {file = "Django-3.2.18-py3-none-any.whl", hash = "sha256:4d492d9024c7b3dfababf49f94511ab6a58e2c9c3c7207786f1ba4eb77750706"}, - {file = "Django-3.2.18.tar.gz", hash = "sha256:08208dfe892eb64fff073ca743b3b952311104f939e7f6dae954fe72dcc533ba"}, + {file = "Django-3.2.19-py3-none-any.whl", hash = "sha256:21cc991466245d659ab79cb01204f9515690f8dae00e5eabde307f14d24d4d7d"}, + {file = "Django-3.2.19.tar.gz", hash = "sha256:031365bae96814da19c10706218c44dff3b654cc4de20a98bd2d29b9bde469f0"}, ] [package.dependencies] @@ -293,14 +296,14 @@ testing = ["coverage[toml] (>=5.0a4)", "pytest (>=4.6.11)"] [[package]] name = "django-filter" -version = "22.1" +version = "23.2" description = "Django-filter is a reusable Django application for allowing users to filter querysets dynamically." category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "django-filter-22.1.tar.gz", hash = "sha256:ed473b76e84f7e83b2511bb2050c3efb36d135207d0128dfe3ae4b36e3594ba5"}, - {file = "django_filter-22.1-py3-none-any.whl", hash = "sha256:ed429e34760127e3520a67f415bec4c905d4649fbe45d0d6da37e6ff5e0287eb"}, + {file = "django-filter-23.2.tar.gz", hash = "sha256:2fe15f78108475eda525692813205fa6f9e8c1caf1ae65daa5862d403c6dbf00"}, + {file = "django_filter-23.2-py3-none-any.whl", hash = "sha256:d12d8e0fc6d3eb26641e553e5d53b191eb8cec611427d4bdce0becb1f7c172b5"}, ] [package.dependencies] @@ -420,62 +423,62 @@ i18n = ["Babel (>=2.7)"] [[package]] name = "markupsafe" -version = "2.1.2" +version = "2.1.3" description = "Safely add untrusted strings to HTML/XML markup." category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "MarkupSafe-2.1.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:665a36ae6f8f20a4676b53224e33d456a6f5a72657d9c83c2aa00765072f31f7"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:340bea174e9761308703ae988e982005aedf427de816d1afe98147668cc03036"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:22152d00bf4a9c7c83960521fc558f55a1adbc0631fbb00a9471e097b19d72e1"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:28057e985dace2f478e042eaa15606c7efccb700797660629da387eb289b9323"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ca244fa73f50a800cf8c3ebf7fd93149ec37f5cb9596aa8873ae2c1d23498601"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:d9d971ec1e79906046aa3ca266de79eac42f1dbf3612a05dc9368125952bd1a1"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:7e007132af78ea9df29495dbf7b5824cb71648d7133cf7848a2a5dd00d36f9ff"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:7313ce6a199651c4ed9d7e4cfb4aa56fe923b1adf9af3b420ee14e6d9a73df65"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-win32.whl", hash = "sha256:c4a549890a45f57f1ebf99c067a4ad0cb423a05544accaf2b065246827ed9603"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-win_amd64.whl", hash = "sha256:835fb5e38fd89328e9c81067fd642b3593c33e1e17e2fdbf77f5676abb14a156"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:2ec4f2d48ae59bbb9d1f9d7efb9236ab81429a764dedca114f5fdabbc3788013"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:608e7073dfa9e38a85d38474c082d4281f4ce276ac0010224eaba11e929dd53a"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:65608c35bfb8a76763f37036547f7adfd09270fbdbf96608be2bead319728fcd"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f2bfb563d0211ce16b63c7cb9395d2c682a23187f54c3d79bfec33e6705473c6"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:da25303d91526aac3672ee6d49a2f3db2d9502a4a60b55519feb1a4c7714e07d"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:9cad97ab29dfc3f0249b483412c85c8ef4766d96cdf9dcf5a1e3caa3f3661cf1"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:085fd3201e7b12809f9e6e9bc1e5c96a368c8523fad5afb02afe3c051ae4afcc"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:1bea30e9bf331f3fef67e0a3877b2288593c98a21ccb2cf29b74c581a4eb3af0"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-win32.whl", hash = "sha256:7df70907e00c970c60b9ef2938d894a9381f38e6b9db73c5be35e59d92e06625"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-win_amd64.whl", hash = "sha256:e55e40ff0cc8cc5c07996915ad367fa47da6b3fc091fdadca7f5403239c5fec3"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:a6e40afa7f45939ca356f348c8e23048e02cb109ced1eb8420961b2f40fb373a"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cf877ab4ed6e302ec1d04952ca358b381a882fbd9d1b07cccbfd61783561f98a"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:63ba06c9941e46fa389d389644e2d8225e0e3e5ebcc4ff1ea8506dce646f8c8a"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f1cd098434e83e656abf198f103a8207a8187c0fc110306691a2e94a78d0abb2"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:55f44b440d491028addb3b88f72207d71eeebfb7b5dbf0643f7c023ae1fba619"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:a6f2fcca746e8d5910e18782f976489939d54a91f9411c32051b4aab2bd7c513"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:0b462104ba25f1ac006fdab8b6a01ebbfbce9ed37fd37fd4acd70c67c973e460"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-win32.whl", hash = "sha256:7668b52e102d0ed87cb082380a7e2e1e78737ddecdde129acadb0eccc5423859"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-win_amd64.whl", hash = "sha256:6d6607f98fcf17e534162f0709aaad3ab7a96032723d8ac8750ffe17ae5a0666"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:a806db027852538d2ad7555b203300173dd1b77ba116de92da9afbc3a3be3eed"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:a4abaec6ca3ad8660690236d11bfe28dfd707778e2442b45addd2f086d6ef094"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f03a532d7dee1bed20bc4884194a16160a2de9ffc6354b3878ec9682bb623c54"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4cf06cdc1dda95223e9d2d3c58d3b178aa5dacb35ee7e3bbac10e4e1faacb419"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:22731d79ed2eb25059ae3df1dfc9cb1546691cc41f4e3130fe6bfbc3ecbbecfa"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:f8ffb705ffcf5ddd0e80b65ddf7bed7ee4f5a441ea7d3419e861a12eaf41af58"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:8db032bf0ce9022a8e41a22598eefc802314e81b879ae093f36ce9ddf39ab1ba"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:2298c859cfc5463f1b64bd55cb3e602528db6fa0f3cfd568d3605c50678f8f03"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-win32.whl", hash = "sha256:50c42830a633fa0cf9e7d27664637532791bfc31c731a87b202d2d8ac40c3ea2"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-win_amd64.whl", hash = "sha256:bb06feb762bade6bf3c8b844462274db0c76acc95c52abe8dbed28ae3d44a147"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:99625a92da8229df6d44335e6fcc558a5037dd0a760e11d84be2260e6f37002f"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:8bca7e26c1dd751236cfb0c6c72d4ad61d986e9a41bbf76cb445f69488b2a2bd"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:40627dcf047dadb22cd25ea7ecfe9cbf3bbbad0482ee5920b582f3809c97654f"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:40dfd3fefbef579ee058f139733ac336312663c6706d1163b82b3003fb1925c4"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:090376d812fb6ac5f171e5938e82e7f2d7adc2b629101cec0db8b267815c85e2"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:2e7821bffe00aa6bd07a23913b7f4e01328c3d5cc0b40b36c0bd81d362faeb65"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:c0a33bc9f02c2b17c3ea382f91b4db0e6cde90b63b296422a939886a7a80de1c"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:b8526c6d437855442cdd3d87eede9c425c4445ea011ca38d937db299382e6fa3"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-win32.whl", hash = "sha256:137678c63c977754abe9086a3ec011e8fd985ab90631145dfb9294ad09c102a7"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-win_amd64.whl", hash = "sha256:0576fe974b40a400449768941d5d0858cc624e3249dfd1e0c33674e5c7ca7aed"}, - {file = "MarkupSafe-2.1.2.tar.gz", hash = "sha256:abcabc8c2b26036d62d4c746381a6f7cf60aafcc653198ad678306986b09450d"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:cd0f502fe016460680cd20aaa5a76d241d6f35a1c3350c474bac1273803893fa"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e09031c87a1e51556fdcb46e5bd4f59dfb743061cf93c4d6831bf894f125eb57"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:68e78619a61ecf91e76aa3e6e8e33fc4894a2bebe93410754bd28fce0a8a4f9f"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:65c1a9bcdadc6c28eecee2c119465aebff8f7a584dd719facdd9e825ec61ab52"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:525808b8019e36eb524b8c68acdd63a37e75714eac50e988180b169d64480a00"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:962f82a3086483f5e5f64dbad880d31038b698494799b097bc59c2edf392fce6"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:aa7bd130efab1c280bed0f45501b7c8795f9fdbeb02e965371bbef3523627779"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:c9c804664ebe8f83a211cace637506669e7890fec1b4195b505c214e50dd4eb7"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-win32.whl", hash = "sha256:10bbfe99883db80bdbaff2dcf681dfc6533a614f700da1287707e8a5d78a8431"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-win_amd64.whl", hash = "sha256:1577735524cdad32f9f694208aa75e422adba74f1baee7551620e43a3141f559"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:ad9e82fb8f09ade1c3e1b996a6337afac2b8b9e365f926f5a61aacc71adc5b3c"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:3c0fae6c3be832a0a0473ac912810b2877c8cb9d76ca48de1ed31e1c68386575"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b076b6226fb84157e3f7c971a47ff3a679d837cf338547532ab866c57930dbee"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bfce63a9e7834b12b87c64d6b155fdd9b3b96191b6bd334bf37db7ff1fe457f2"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:338ae27d6b8745585f87218a3f23f1512dbf52c26c28e322dbe54bcede54ccb9"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e4dd52d80b8c83fdce44e12478ad2e85c64ea965e75d66dbeafb0a3e77308fcc"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:df0be2b576a7abbf737b1575f048c23fb1d769f267ec4358296f31c2479db8f9"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-win32.whl", hash = "sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl", hash = "sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ca379055a47383d02a5400cb0d110cef0a776fc644cda797db0c5696cfd7e18e"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:b7ff0f54cb4ff66dd38bebd335a38e2c22c41a8ee45aa608efc890ac3e3931bc"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:c011a4149cfbcf9f03994ec2edffcb8b1dc2d2aede7ca243746df97a5d41ce48"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:56d9f2ecac662ca1611d183feb03a3fa4406469dafe241673d521dd5ae92a155"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-win32.whl", hash = "sha256:8758846a7e80910096950b67071243da3e5a20ed2546e6392603c096778d48e0"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-win_amd64.whl", hash = "sha256:787003c0ddb00500e49a10f2844fac87aa6ce977b90b0feaaf9de23c22508b24"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:2ef12179d3a291be237280175b542c07a36e7f60718296278d8593d21ca937d4"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:2c1b19b3aaacc6e57b7e25710ff571c24d6c3613a45e905b1fde04d691b98ee0"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8afafd99945ead6e075b973fefa56379c5b5c53fd8937dad92c662da5d8fd5ee"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8c41976a29d078bb235fea9b2ecd3da465df42a562910f9022f1a03107bd02be"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d080e0a5eb2529460b30190fcfcc4199bd7f827663f858a226a81bc27beaa97e"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:69c0f17e9f5a7afdf2cc9fb2d1ce6aabdb3bafb7f38017c0b77862bcec2bbad8"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:504b320cd4b7eff6f968eddf81127112db685e81f7e36e75f9f84f0df46041c3"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:42de32b22b6b804f42c5d98be4f7e5e977ecdd9ee9b660fda1a3edf03b11792d"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-win32.whl", hash = "sha256:ceb01949af7121f9fc39f7d27f91be8546f3fb112c608bc4029aef0bab86a2a5"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-win_amd64.whl", hash = "sha256:1b40069d487e7edb2676d3fbdb2b0829ffa2cd63a2ec26c4938b2d34391b4ecc"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:8023faf4e01efadfa183e863fefde0046de576c6f14659e8782065bcece22198"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:6b2b56950d93e41f33b4223ead100ea0fe11f8e6ee5f641eb753ce4b77a7042b"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9dcdfd0eaf283af041973bff14a2e143b8bd64e069f4c383416ecd79a81aab58"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:05fb21170423db021895e1ea1e1f3ab3adb85d1c2333cbc2310f2a26bc77272e"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:282c2cb35b5b673bbcadb33a585408104df04f14b2d9b01d4c345a3b92861c2c"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:ab4a0df41e7c16a1392727727e7998a467472d0ad65f3ad5e6e765015df08636"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:7ef3cb2ebbf91e330e3bb937efada0edd9003683db6b57bb108c4001f37a02ea"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:0a4e4a1aff6c7ac4cd55792abf96c915634c2b97e3cc1c7129578aa68ebd754e"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-win32.whl", hash = "sha256:fec21693218efe39aa7f8599346e90c705afa52c5b31ae019b2e57e8f6542bb2"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-win_amd64.whl", hash = "sha256:3fd4abcb888d15a94f32b75d8fd18ee162ca0c064f35b11134be77050296d6ba"}, + {file = "MarkupSafe-2.1.3.tar.gz", hash = "sha256:af598ed32d6ae86f1b747b82783958b1a4ab8f617b06fe68795c7f026abbdcad"}, ] [[package]] @@ -492,14 +495,14 @@ files = [ [[package]] name = "packaging" -version = "23.0" +version = "23.1" description = "Core utilities for Python packages" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "packaging-23.0-py3-none-any.whl", hash = "sha256:714ac14496c3e68c99c29b00845f7a2b85f3bb6f1078fd9f72fd20f0570002b2"}, - {file = "packaging-23.0.tar.gz", hash = "sha256:b6ad297f8907de0fa2fe1ccbd26fdaf387f5f47c7275fedf8cce89f99446cf97"}, + {file = "packaging-23.1-py3-none-any.whl", hash = "sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61"}, + {file = "packaging-23.1.tar.gz", hash = "sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f"}, ] [[package]] @@ -516,30 +519,30 @@ files = [ [[package]] name = "platformdirs" -version = "3.1.1" +version = "3.5.3" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "platformdirs-3.1.1-py3-none-any.whl", hash = "sha256:e5986afb596e4bb5bde29a79ac9061aa955b94fca2399b7aaac4090860920dd8"}, - {file = "platformdirs-3.1.1.tar.gz", hash = "sha256:024996549ee88ec1a9aa99ff7f8fc819bb59e2c3477b410d90a16d32d6e707aa"}, + {file = "platformdirs-3.5.3-py3-none-any.whl", hash = "sha256:0ade98a4895e87dc51d47151f7d2ec290365a585151d97b4d8d6312ed6132fed"}, + {file = "platformdirs-3.5.3.tar.gz", hash = "sha256:e48fabd87db8f3a7df7150a4a5ea22c546ee8bc39bc2473244730d4b56d2cc4e"}, ] [package.extras] -docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"] -test = ["appdirs (==1.4.4)", "covdefaults (>=2.2.2)", "pytest (>=7.2.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] +docs = ["furo (>=2023.5.20)", "proselint (>=0.13)", "sphinx (>=7.0.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest-cov (>=4.1)", "pytest-mock (>=3.10)"] [[package]] name = "pytz" -version = "2022.7.1" +version = "2023.3" description = "World timezone definitions, modern and historical" category = "main" optional = false python-versions = "*" files = [ - {file = "pytz-2022.7.1-py2.py3-none-any.whl", hash = "sha256:78f4f37d8198e0627c5f1143240bb0206b8691d8d7ac6d78fee88b78733f8c4a"}, - {file = "pytz-2022.7.1.tar.gz", hash = "sha256:01a0681c4b9684a28304615eba55d1ab31ae00bf68ec157ec3708a8182dbbcd0"}, + {file = "pytz-2023.3-py2.py3-none-any.whl", hash = "sha256:a151b3abb88eda1d4e34a9814df37de2a80e301e68ba0fd856fb9b46bfbbbffb"}, + {file = "pytz-2023.3.tar.gz", hash = "sha256:1d8ce29db189191fb55338ee6d0387d82ab59f3d00eac103412d64e0ebd0c588"}, ] [[package]] @@ -555,21 +558,21 @@ files = [ [[package]] name = "requests" -version = "2.28.2" +version = "2.31.0" description = "Python HTTP for Humans." category = "main" optional = false -python-versions = ">=3.7, <4" +python-versions = ">=3.7" files = [ - {file = "requests-2.28.2-py3-none-any.whl", hash = "sha256:64299f4909223da747622c030b781c0d7811e359c37124b4bd368fb8c6518baa"}, - {file = "requests-2.28.2.tar.gz", hash = "sha256:98b1b2782e3c6c4904938b84c0eb932721069dfdb9134313beff7c83c2df24bf"}, + {file = "requests-2.31.0-py3-none-any.whl", hash = "sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f"}, + {file = "requests-2.31.0.tar.gz", hash = "sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1"}, ] [package.dependencies] certifi = ">=2017.4.17" charset-normalizer = ">=2,<4" idna = ">=2.5,<4" -urllib3 = ">=1.21.1,<1.27" +urllib3 = ">=1.21.1,<3" [package.extras] socks = ["PySocks (>=1.5.6,!=1.5.7)"] @@ -577,16 +580,21 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] [[package]] name = "sqlparse" -version = "0.4.3" +version = "0.4.4" description = "A non-validating SQL parser." category = "main" optional = false python-versions = ">=3.5" files = [ - {file = "sqlparse-0.4.3-py3-none-any.whl", hash = "sha256:0323c0ec29cd52bceabc1b4d9d579e311f3e4961b98d174201d5622a23b85e34"}, - {file = "sqlparse-0.4.3.tar.gz", hash = "sha256:69ca804846bb114d2ec380e4360a8a340db83f0ccf3afceeb1404df028f57268"}, + {file = "sqlparse-0.4.4-py3-none-any.whl", hash = "sha256:5430a4fe2ac7d0f93e66f1efc6e1338a41884b7ddf2a350cedd20ccc4d9d28f3"}, + {file = "sqlparse-0.4.4.tar.gz", hash = "sha256:d446183e84b8349fa3061f0fe7f06ca94ba65b426946ffebe6e3e8295332420c"}, ] +[package.extras] +dev = ["build", "flake8"] +doc = ["sphinx"] +test = ["pytest", "pytest-cov"] + [[package]] name = "tomli" version = "2.0.1" @@ -601,14 +609,14 @@ files = [ [[package]] name = "typing-extensions" -version = "4.5.0" +version = "4.6.3" description = "Backported and Experimental Type Hints for Python 3.7+" -category = "dev" +category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "typing_extensions-4.5.0-py3-none-any.whl", hash = "sha256:fb33085c39dd998ac16d1431ebc293a8b3eedd00fd4a32de0ff79002c19511b4"}, - {file = "typing_extensions-4.5.0.tar.gz", hash = "sha256:5cb5f4a79139d699607b3ef622a1dedafa84e115ab0024e0d9c044a9479ca7cb"}, + {file = "typing_extensions-4.6.3-py3-none-any.whl", hash = "sha256:88a4153d8505aabbb4e13aacb7c486c2b4a33ca3b3f807914a9b4c844c471c26"}, + {file = "typing_extensions-4.6.3.tar.gz", hash = "sha256:d91d5919357fe7f681a9f2b5b4cb2a5f1ef0a1e9f59c4d8ff0d3491e05c0ffd5"}, ] [[package]] @@ -625,20 +633,21 @@ files = [ [[package]] name = "urllib3" -version = "1.26.15" +version = "2.0.3" description = "HTTP library with thread-safe connection pooling, file post, and more." category = "main" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" +python-versions = ">=3.7" files = [ - {file = "urllib3-1.26.15-py2.py3-none-any.whl", hash = "sha256:aa751d169e23c7479ce47a0cb0da579e3ede798f994f5816a74e4f4500dcea42"}, - {file = "urllib3-1.26.15.tar.gz", hash = "sha256:8a388717b9476f934a21484e8c8e61875ab60644d29b9b39e11e4b9dc1c6b305"}, + {file = "urllib3-2.0.3-py3-none-any.whl", hash = "sha256:48e7fafa40319d358848e1bc6809b208340fafe2096f1725d05d67443d0483d1"}, + {file = "urllib3-2.0.3.tar.gz", hash = "sha256:bee28b5e56addb8226c96f7f13ac28cb4c301dd5ea8a6ca179c0b9835e032825"}, ] [package.extras] -brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"] -secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "ipaddress", "pyOpenSSL (>=0.14)", "urllib3-secure-extra"] -socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] +brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"] +secure = ["certifi", "cryptography (>=1.9)", "idna (>=2.0.0)", "pyopenssl (>=17.1.0)", "urllib3-secure-extra"] +socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] +zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.0" diff --git a/pyproject.toml b/pyproject.toml index d59146d..3bac664 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-mapengine" -version = "0.9.0" +version = "0.10.0" description = "Map engine for maplibre in django" authors = ["Hendrik Huyskens "] readme = "README.md" From 72080ba565649640b47d6e0fc4fc1cf11183f7b4 Mon Sep 17 00:00:00 2001 From: "RL-INSTITUT\\hendrik.huyskens" Date: Mon, 12 Jun 2023 16:57:34 +0200 Subject: [PATCH 12/27] Fix no choropleths set --- CHANGELOG.md | 3 +++ django_mapengine/apps.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9178890..f4d853f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ Here is a template for new release sections ### Changed - chart options are taken from backend; no frontend modifications +### Fixed +- no choropleths set in settings + ## [0.9.0] - 2023-06-09 ### Added - title and unit for choropleths in legend diff --git a/django_mapengine/apps.py b/django_mapengine/apps.py index f40359e..c3cc088 100644 --- a/django_mapengine/apps.py +++ b/django_mapengine/apps.py @@ -72,6 +72,9 @@ class MapEngineConf(AppConf): # IMAGES IMAGES: List[Dict[str, str]] = [] + # CHOROPLETHS + CHOROPLETHS = [] + # POPUPS POPUPS: List[str] = [] From c6903c34d8e8f3c60f5de9881bcf1841eadb0d09 Mon Sep 17 00:00:00 2001 From: "RL-INSTITUT\\hendrik.huyskens" Date: Mon, 12 Jun 2023 16:58:40 +0200 Subject: [PATCH 13/27] Minor change --- django_mapengine/static/django_mapengine/js/choropleth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_mapengine/static/django_mapengine/js/choropleth.js b/django_mapengine/static/django_mapengine/js/choropleth.js index 4aa1895..e187f37 100644 --- a/django_mapengine/static/django_mapengine/js/choropleth.js +++ b/django_mapengine/static/django_mapengine/js/choropleth.js @@ -64,7 +64,7 @@ function initDefaultChoropleths() { } } -function deactivateChoropleth(choroplethName) { +function deactivateChoropleth() { for (const choropleth in map_store.cold.choropleths) { for (const layerID of map_store.cold.choropleths[choropleth].layers) { setPaintProperties(layerID, map_store.cold.storedChoroplethPaintProperties["default"][layerID]); From 1a5042952f770c7689d5892fa3bc908b69e6a94f Mon Sep 17 00:00:00 2001 From: Hendrik Huyskens Date: Thu, 15 Jun 2023 09:50:58 +0200 Subject: [PATCH 14/27] Minor change --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index a22a741..6a362e8 100644 --- a/environment.yml +++ b/environment.yml @@ -1,3 +1,3 @@ -name: django_oemof +name: django_mapengine dependencies: - python=3.9 From 67a77267994d4594aa8e8cfc5563116017baebbf Mon Sep 17 00:00:00 2001 From: Hendrik Huyskens Date: Thu, 15 Jun 2023 10:41:06 +0200 Subject: [PATCH 15/27] Chart creation in popup is handled by project app (not mapengine) --- CHANGELOG.md | 7 +++++++ django_mapengine/__init__.py | 2 +- .../static/django_mapengine/js/popup.js | 18 +++++++----------- pyproject.toml | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4d853f..9367343 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ and the versioning aim to respect [Semantic Versioning](http://semver.org/spec/v Here is a template for new release sections +## [0.11.0] - 2023-06-15 +### Changed +- chart creation function must be declared by project app + +### Fixed +- chart errors in popups + ## [0.10.0] - 2023-06-12 ### Changed - chart options are taken from backend; no frontend modifications diff --git a/django_mapengine/__init__.py b/django_mapengine/__init__.py index 1b9e2c3..f28e547 100644 --- a/django_mapengine/__init__.py +++ b/django_mapengine/__init__.py @@ -1,3 +1,3 @@ """Map Engine init, holds version""" -__version__ = "0.10.0" +__version__ = "0.11.0" diff --git a/django_mapengine/static/django_mapengine/js/popup.js b/django_mapengine/static/django_mapengine/js/popup.js index d2719cc..4ebc0f6 100644 --- a/django_mapengine/static/django_mapengine/js/popup.js +++ b/django_mapengine/static/django_mapengine/js/popup.js @@ -61,19 +61,15 @@ function add_popup(layerID) { const {html} = data; popup.innerHTML = html; + new maplibregl.Popup({ + // https://maplibre.org/maplibre-gl-js-docs/api/markers/#popup-parameters + maxWidth: "280px", + }).setLngLat(coordinates).setHTML(popup.innerHTML).addTo(map); + if ("chart" in data) { - // Chart - const chartElement = popup.querySelector("#js-popup__chart"); - const chart = echarts.init(chartElement, null, {renderer: 'svg'}); - chart.setOption(data.chart); + // createChart function must be defined in project app (not in mapengine) + createChart("js-popup__chart", data.chart); } - - requestAnimationFrame(() => { - new maplibregl.Popup({ - // https://maplibre.org/maplibre-gl-js-docs/api/markers/#popup-parameters - maxWidth: "280px", - }).setLngLat(coordinates).setHTML(popup.innerHTML).addTo(map); - }); } }); }); diff --git a/pyproject.toml b/pyproject.toml index 3bac664..cac1258 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-mapengine" -version = "0.10.0" +version = "0.11.0" description = "Map engine for maplibre in django" authors = ["Hendrik Huyskens "] readme = "README.md" From af8854943cd3b452e3705dac6b85c833052337b5 Mon Sep 17 00:00:00 2001 From: Hendrik Huyskens Date: Thu, 15 Jun 2023 10:41:14 +0200 Subject: [PATCH 16/27] Add .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bc8a670 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/* \ No newline at end of file From a7fa82042b30655059f5a9aed83d310232296ee2 Mon Sep 17 00:00:00 2001 From: finnus <40977905+finnus@users.noreply.github.com> Date: Thu, 22 Jun 2023 13:29:57 +0200 Subject: [PATCH 17/27] change keyword to adapt to new legend --- django_mapengine/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_mapengine/views.py b/django_mapengine/views.py index 43960a2..98b2573 100644 --- a/django_mapengine/views.py +++ b/django_mapengine/views.py @@ -85,7 +85,7 @@ def get_context_data(self, **kwargs) -> dict: 'layers': [item[1]], 'useFeatureState': True, 'unit': [item[2]], - 'name': [item[3]] + 'title': [item[3]] } for item in choropleths } From 58636444d03a2b9d6811369ac702808636b172aa Mon Sep 17 00:00:00 2001 From: finnus <40977905+finnus@users.noreply.github.com> Date: Thu, 22 Jun 2023 13:47:30 +0200 Subject: [PATCH 18/27] hand correct title to legend --- django_mapengine/static/django_mapengine/js/legend.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_mapengine/static/django_mapengine/js/legend.js b/django_mapengine/static/django_mapengine/js/legend.js index fa4833a..762772b 100644 --- a/django_mapengine/static/django_mapengine/js/legend.js +++ b/django_mapengine/static/django_mapengine/js/legend.js @@ -76,6 +76,6 @@ function loadLegend(msg, choroplethName){ } } const entriesPerColumn = Math.floor(values.length / 2); - legendElement.innerHTML = createLegend(choroplethName, unit, colors, values, entriesPerColumn); + legendElement.innerHTML = createLegend(title, unit, colors, values, entriesPerColumn); return logMessage(msg); } From 622ec02a7d06e2505e641d987a51b810fe6c5f0c Mon Sep 17 00:00:00 2001 From: Hendrik Huyskens Date: Tue, 27 Jun 2023 16:05:31 +0200 Subject: [PATCH 19/27] SHow cluster layer on top of all layers --- CHANGELOG.md | 4 ++++ django_mapengine/__init__.py | 2 +- django_mapengine/layers.py | 4 ++-- pyproject.toml | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9367343..a6f6809 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and the versioning aim to respect [Semantic Versioning](http://semver.org/spec/v Here is a template for new release sections +## [0.12.0] - 2023-06-27 +### Changed +- layer ordering; cluster layers are shown on top of other layers + ## [0.11.0] - 2023-06-15 ### Changed - chart creation function must be declared by project app diff --git a/django_mapengine/__init__.py b/django_mapengine/__init__.py index f28e547..b9a9fb6 100644 --- a/django_mapengine/__init__.py +++ b/django_mapengine/__init__.py @@ -1,3 +1,3 @@ """Map Engine init, holds version""" -__version__ = "0.11.0" +__version__ = "0.12.0" diff --git a/django_mapengine/layers.py b/django_mapengine/layers.py index b39efcb..d9b8fa2 100644 --- a/django_mapengine/layers.py +++ b/django_mapengine/layers.py @@ -271,8 +271,8 @@ def get_all_layers() -> List[MapLayer]: """ # Order is important! Last items are shown on top! layers = list(get_region_layers()) - for cluster_layer in get_cluster_layers(): - layers.extend(cluster_layer.get_map_layers()) for static_layer in get_static_layers(): layers.extend(static_layer.get_map_layers()) + for cluster_layer in get_cluster_layers(): + layers.extend(cluster_layer.get_map_layers()) return layers diff --git a/pyproject.toml b/pyproject.toml index cac1258..7c36974 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-mapengine" -version = "0.11.0" +version = "0.12.0" description = "Map engine for maplibre in django" authors = ["Hendrik Huyskens "] readme = "README.md" From 0cc4cb693dbb2030ae7f448497fcc48b90e4c307 Mon Sep 17 00:00:00 2001 From: Hendrik Huyskens Date: Wed, 5 Jul 2023 09:44:28 +0200 Subject: [PATCH 20/27] Add cluster properties --- CHANGELOG.md | 4 ++ django_mapengine/__init__.py | 2 +- django_mapengine/setup.py | 4 +- django_mapengine/urls.py | 2 +- poetry.lock | 77 +++++++++++++++--------------------- pyproject.toml | 3 +- 6 files changed, 42 insertions(+), 50 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6f6809..1d1bcb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and the versioning aim to respect [Semantic Versioning](http://semver.org/spec/v Here is a template for new release sections +## [0.13.0] - 2023-07-05 +### Added +- cluster properties to forward model attributes to map engine + ## [0.12.0] - 2023-06-27 ### Changed - layer ordering; cluster layers are shown on top of other layers diff --git a/django_mapengine/__init__.py b/django_mapengine/__init__.py index b9a9fb6..42cb269 100644 --- a/django_mapengine/__init__.py +++ b/django_mapengine/__init__.py @@ -1,3 +1,3 @@ """Map Engine init, holds version""" -__version__ = "0.12.0" +__version__ = "0.13.0" diff --git a/django_mapengine/setup.py b/django_mapengine/setup.py index 614eeca..8294936 100644 --- a/django_mapengine/setup.py +++ b/django_mapengine/setup.py @@ -1,7 +1,7 @@ """Setup module is used in settings of django projects to set up mapengine""" from collections import namedtuple -from dataclasses import dataclass +from dataclasses import dataclass, field from typing import TYPE_CHECKING, List, Optional from django.apps import apps @@ -42,8 +42,10 @@ def model(self) -> "Model": # pylint:disable=R0903 +@dataclass class ClusterAPI(ModelAPI): """Exists only to distinguish between "normal" and clustered API""" + properties: list = field(default_factory=lambda: []) @dataclass diff --git a/django_mapengine/urls.py b/django_mapengine/urls.py index 2135b87..88752f6 100644 --- a/django_mapengine/urls.py +++ b/django_mapengine/urls.py @@ -16,7 +16,7 @@ urlpatterns += [ path( f"clusters/{cluster.layer_id}.geojson", - GeoJSONLayerView.as_view(model=cluster.model), + GeoJSONLayerView.as_view(model=cluster.model, properties=cluster.properties), name=f"{cluster.layer_id}_cluster", ) for cluster in settings.MAP_ENGINE_API_CLUSTERS diff --git a/poetry.lock b/poetry.lock index e03651a..53f3c33 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,10 +1,9 @@ -# This file is automatically @generated by Poetry 1.4.0 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand. [[package]] name = "asgiref" version = "3.7.2" description = "ASGI specs, helper code, and adapters" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -22,7 +21,6 @@ tests = ["mypy (>=0.800)", "pytest", "pytest-asyncio"] name = "black" version = "23.3.0" description = "The uncompromising code formatter." -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -72,7 +70,6 @@ uvloop = ["uvloop (>=0.15.2)"] name = "certifi" version = "2023.5.7" description = "Python package for providing Mozilla's CA Bundle." -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -84,7 +81,6 @@ files = [ name = "charset-normalizer" version = "3.1.0" description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." -category = "main" optional = false python-versions = ">=3.7.0" files = [ @@ -169,7 +165,6 @@ files = [ name = "click" version = "8.1.3" description = "Composable command line interface toolkit" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -184,7 +179,6 @@ colorama = {version = "*", markers = "platform_system == \"Windows\""} name = "colorama" version = "0.4.6" description = "Cross-platform colored terminal text." -category = "dev" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" files = [ @@ -196,7 +190,6 @@ files = [ name = "colorbrewer" version = "2.0.0" description = "Colorbrewer package" -category = "main" optional = false python-versions = "^3.9" files = [] @@ -212,7 +205,6 @@ resolved_reference = "83ad64fef2617500e2d7b0dc2acc27214f462d3c" name = "coreapi" version = "2.3.3" description = "Python client library for Core API." -category = "main" optional = false python-versions = "*" files = [ @@ -230,7 +222,6 @@ uritemplate = "*" name = "coreschema" version = "0.0.4" description = "Core Schema." -category = "main" optional = false python-versions = "*" files = [ @@ -243,14 +234,13 @@ jinja2 = "*" [[package]] name = "django" -version = "3.2.19" +version = "3.2.20" description = "A high-level Python Web framework that encourages rapid development and clean, pragmatic design." -category = "main" optional = false python-versions = ">=3.6" files = [ - {file = "Django-3.2.19-py3-none-any.whl", hash = "sha256:21cc991466245d659ab79cb01204f9515690f8dae00e5eabde307f14d24d4d7d"}, - {file = "Django-3.2.19.tar.gz", hash = "sha256:031365bae96814da19c10706218c44dff3b654cc4de20a98bd2d29b9bde469f0"}, + {file = "Django-3.2.20-py3-none-any.whl", hash = "sha256:a477ab326ae7d8807dc25c186b951ab8c7648a3a23f9497763c37307a2b5ef87"}, + {file = "Django-3.2.20.tar.gz", hash = "sha256:dec2a116787b8e14962014bf78e120bba454135108e1af9e9b91ade7b2964c40"}, ] [package.dependencies] @@ -266,7 +256,6 @@ bcrypt = ["bcrypt"] name = "django-appconf" version = "1.0.5" description = "A helper class for handling configuration defaults of packaged apps gracefully." -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -281,7 +270,6 @@ django = "*" name = "django-environ" version = "0.10.0" description = "A package that allows you to utilize 12factor inspired environment variables to configure your Django application." -category = "main" optional = false python-versions = ">=3.5,<4" files = [ @@ -290,15 +278,14 @@ files = [ ] [package.extras] -develop = ["coverage[toml] (>=5.0a4)", "furo (>=2021.8.17b43,<2021.9.0)", "pytest (>=4.6.11)", "sphinx (>=3.5.0)", "sphinx-notfound-page"] -docs = ["furo (>=2021.8.17b43,<2021.9.0)", "sphinx (>=3.5.0)", "sphinx-notfound-page"] +develop = ["coverage[toml] (>=5.0a4)", "furo (>=2021.8.17b43,<2021.9.dev0)", "pytest (>=4.6.11)", "sphinx (>=3.5.0)", "sphinx-notfound-page"] +docs = ["furo (>=2021.8.17b43,<2021.9.dev0)", "sphinx (>=3.5.0)", "sphinx-notfound-page"] testing = ["coverage[toml] (>=5.0a4)", "pytest (>=4.6.11)"] [[package]] name = "django-filter" version = "23.2" description = "Django-filter is a reusable Django application for allowing users to filter querysets dynamically." -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -309,11 +296,28 @@ files = [ [package.dependencies] Django = ">=3.2" +[[package]] +name = "django-geojson" +version = "3.2.1" +description = "Serve vectorial map layers with Django" +optional = false +python-versions = ">=3.5" +files = [ + {file = "django-geojson-3.2.1.tar.gz", hash = "sha256:191c0b97a02eed7c4a7d535775dbf4426985b1e1c1bfbdceee1acd066ae2622c"}, + {file = "django_geojson-3.2.1-py3-none-any.whl", hash = "sha256:3802ece58a94485fa3c25feda7c0f166f9579c69c0243e41d3a1e578b7e9da1e"}, +] + +[package.dependencies] +Django = ">=2.2" + +[package.extras] +docs = ["sphinx", "sphinx-autobuild"] +field = ["django-leaflet (>=0.12)", "jsonfield"] + [[package]] name = "djangorestframework" version = "3.14.0" description = "Web APIs for Django, made easy." -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -329,7 +333,6 @@ pytz = "*" name = "djangorestframework-gis" version = "1.0" description = "Geographic add-ons for Django Rest Framework" -category = "main" optional = false python-versions = "*" files = [ @@ -344,7 +347,6 @@ djangorestframework = "*" name = "djangorestframework-mvt" version = "0.2.5" description = " A Django REST Framework extension for creating views that serialize model data to Google Protobuf encoded Map Box Vector Tiles via Postgres. " -category = "main" optional = false python-versions = "*" files = [ @@ -365,7 +367,6 @@ dev = ["black", "coveralls", "mock", "pylint", "pytest", "pytest-cov", "sphinx", name = "idna" version = "3.4" description = "Internationalized Domain Names in Applications (IDNA)" -category = "main" optional = false python-versions = ">=3.5" files = [ @@ -377,7 +378,6 @@ files = [ name = "isort" version = "5.12.0" description = "A Python utility / library to sort Python imports." -category = "dev" optional = false python-versions = ">=3.8.0" files = [ @@ -395,7 +395,6 @@ requirements-deprecated-finder = ["pip-api", "pipreqs"] name = "itypes" version = "1.2.0" description = "Simple immutable types for python." -category = "main" optional = false python-versions = "*" files = [ @@ -407,7 +406,6 @@ files = [ name = "jinja2" version = "3.1.2" description = "A very fast and expressive template engine." -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -425,7 +423,6 @@ i18n = ["Babel (>=2.7)"] name = "markupsafe" version = "2.1.3" description = "Safely add untrusted strings to HTML/XML markup." -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -485,7 +482,6 @@ files = [ name = "mypy-extensions" version = "1.0.0" description = "Type system extensions for programs checked with the mypy type checker." -category = "dev" optional = false python-versions = ">=3.5" files = [ @@ -497,7 +493,6 @@ files = [ name = "packaging" version = "23.1" description = "Core utilities for Python packages" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -509,7 +504,6 @@ files = [ name = "pathspec" version = "0.11.1" description = "Utility library for gitignore style pattern matching of file paths." -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -519,14 +513,13 @@ files = [ [[package]] name = "platformdirs" -version = "3.5.3" +version = "3.8.0" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." -category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "platformdirs-3.5.3-py3-none-any.whl", hash = "sha256:0ade98a4895e87dc51d47151f7d2ec290365a585151d97b4d8d6312ed6132fed"}, - {file = "platformdirs-3.5.3.tar.gz", hash = "sha256:e48fabd87db8f3a7df7150a4a5ea22c546ee8bc39bc2473244730d4b56d2cc4e"}, + {file = "platformdirs-3.8.0-py3-none-any.whl", hash = "sha256:ca9ed98ce73076ba72e092b23d3c93ea6c4e186b3f1c3dad6edd98ff6ffcca2e"}, + {file = "platformdirs-3.8.0.tar.gz", hash = "sha256:b0cabcb11063d21a0b261d557acb0a9d2126350e63b70cdf7db6347baea456dc"}, ] [package.extras] @@ -537,7 +530,6 @@ test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest- name = "pytz" version = "2023.3" description = "World timezone definitions, modern and historical" -category = "main" optional = false python-versions = "*" files = [ @@ -549,7 +541,6 @@ files = [ name = "range-key-dict" version = "1.1.0" description = "A dict with range as key" -category = "main" optional = false python-versions = "*" files = [ @@ -560,7 +551,6 @@ files = [ name = "requests" version = "2.31.0" description = "Python HTTP for Humans." -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -582,7 +572,6 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] name = "sqlparse" version = "0.4.4" description = "A non-validating SQL parser." -category = "main" optional = false python-versions = ">=3.5" files = [ @@ -599,7 +588,6 @@ test = ["pytest", "pytest-cov"] name = "tomli" version = "2.0.1" description = "A lil' TOML parser" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -609,21 +597,19 @@ files = [ [[package]] name = "typing-extensions" -version = "4.6.3" +version = "4.7.1" description = "Backported and Experimental Type Hints for Python 3.7+" -category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "typing_extensions-4.6.3-py3-none-any.whl", hash = "sha256:88a4153d8505aabbb4e13aacb7c486c2b4a33ca3b3f807914a9b4c844c471c26"}, - {file = "typing_extensions-4.6.3.tar.gz", hash = "sha256:d91d5919357fe7f681a9f2b5b4cb2a5f1ef0a1e9f59c4d8ff0d3491e05c0ffd5"}, + {file = "typing_extensions-4.7.1-py3-none-any.whl", hash = "sha256:440d5dd3af93b060174bf433bccd69b0babc3b15b1a8dca43789fd7f61514b36"}, + {file = "typing_extensions-4.7.1.tar.gz", hash = "sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2"}, ] [[package]] name = "uritemplate" version = "4.1.1" description = "Implementation of RFC 6570 URI Templates" -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -635,7 +621,6 @@ files = [ name = "urllib3" version = "2.0.3" description = "HTTP library with thread-safe connection pooling, file post, and more." -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -652,4 +637,4 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.12" -content-hash = "c4da49ecd7045c1d7324e2df019ec341151aa261d9a7667106782b974a997dce" +content-hash = "2408b0210f6d69fc144f098b0e8488be04a2cf8376063860724d2f91cab36ebc" diff --git a/pyproject.toml b/pyproject.toml index 7c36974..372fd9e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-mapengine" -version = "0.12.0" +version = "0.13.0" description = "Map engine for maplibre in django" authors = ["Hendrik Huyskens "] readme = "README.md" @@ -14,6 +14,7 @@ colorbrewer = {git = "https://github.com/henhuy/colorbrewer-python.git"} djangorestframework = "^3.14.0" djangorestframework-mvt = "^0.2.5" django-appconf = "^1.0.5" +django-geojson = "^3.1.0" [tool.poetry.group.dev.dependencies] From 06c0d2e2dee2aef771041e1cab89f569f876bbd4 Mon Sep 17 00:00:00 2001 From: Hendrik Huyskens Date: Thu, 13 Jul 2023 11:08:38 +0200 Subject: [PATCH 21/27] Fix choropleth legend unit brackets --- django_mapengine/static/django_mapengine/js/legend.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_mapengine/static/django_mapengine/js/legend.js b/django_mapengine/static/django_mapengine/js/legend.js index 762772b..aed4656 100644 --- a/django_mapengine/static/django_mapengine/js/legend.js +++ b/django_mapengine/static/django_mapengine/js/legend.js @@ -20,7 +20,7 @@ const createLegend = (title, unit, colors, valueRanges, nextColumnStartIndex = 3
Legend -  ${title} -
(${unit})
+
${unit ? `(${unit})` : ""}
From e28699847acb59849ad18cec5105c71bb4f3715a Mon Sep 17 00:00:00 2001 From: Hendrik Huyskens Date: Thu, 13 Jul 2023 11:09:45 +0200 Subject: [PATCH 22/27] Update version to v0.13.1 --- CHANGELOG.md | 4 ++++ django_mapengine/__init__.py | 2 +- pyproject.toml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d1bcb4..b1481ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and the versioning aim to respect [Semantic Versioning](http://semver.org/spec/v Here is a template for new release sections +## [0.13.1] - 2023-07-13 +### Fixed +- choropleth legend unit brackets + ## [0.13.0] - 2023-07-05 ### Added - cluster properties to forward model attributes to map engine diff --git a/django_mapengine/__init__.py b/django_mapengine/__init__.py index 42cb269..7fa0a92 100644 --- a/django_mapengine/__init__.py +++ b/django_mapengine/__init__.py @@ -1,3 +1,3 @@ """Map Engine init, holds version""" -__version__ = "0.13.0" +__version__ = "0.13.1" diff --git a/pyproject.toml b/pyproject.toml index 372fd9e..a408af8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-mapengine" -version = "0.13.0" +version = "0.13.1" description = "Map engine for maplibre in django" authors = ["Hendrik Huyskens "] readme = "README.md" From 14204e2ee3bc5e8146c17928b68130832be6e63b Mon Sep 17 00:00:00 2001 From: Hendrik Huyskens Date: Wed, 23 Aug 2023 13:12:30 +0200 Subject: [PATCH 23/27] Fix map_store initialization initStore has been overridden by digiplan --- CHANGELOG.md | 4 ++++ django_mapengine/__init__.py | 2 +- django_mapengine/static/django_mapengine/js/init.js | 4 ++-- pyproject.toml | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1481ed..d9aa906 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and the versioning aim to respect [Semantic Versioning](http://semver.org/spec/v Here is a template for new release sections +## [0.13.2] - 2023-08-23 +### Fixed +- map store initialization + ## [0.13.1] - 2023-07-13 ### Fixed - choropleth legend unit brackets diff --git a/django_mapengine/__init__.py b/django_mapengine/__init__.py index 7fa0a92..431ba2e 100644 --- a/django_mapengine/__init__.py +++ b/django_mapengine/__init__.py @@ -1,3 +1,3 @@ """Map Engine init, holds version""" -__version__ = "0.13.1" +__version__ = "0.13.2" diff --git a/django_mapengine/static/django_mapengine/js/init.js b/django_mapengine/static/django_mapengine/js/init.js index 7ac1bca..406cd50 100644 --- a/django_mapengine/static/django_mapengine/js/init.js +++ b/django_mapengine/static/django_mapengine/js/init.js @@ -1,5 +1,5 @@ -const map_store = initStore(); +const map_store = initMapStore(); const map = initMap(); @@ -26,7 +26,7 @@ function initMap() { } -function initStore() { +function initMapStore() { const storeColdInit = JSON.parse(document.getElementById("mapengine_store_cold_init").textContent); storeColdInit.state = {}; storeColdInit.storedChoroplethPaintProperties = {"default": {}}; diff --git a/pyproject.toml b/pyproject.toml index a408af8..38b0ec0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-mapengine" -version = "0.13.1" +version = "0.13.2" description = "Map engine for maplibre in django" authors = ["Hendrik Huyskens "] readme = "README.md" From d97f47556cd2a7bf7d340233d4e8eeb9d5eff88f Mon Sep 17 00:00:00 2001 From: finnus <40977905+finnus@users.noreply.github.com> Date: Wed, 24 May 2023 14:01:52 +0200 Subject: [PATCH 24/27] add optional model for map layers --- django_mapengine/views.py | 45 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/django_mapengine/views.py b/django_mapengine/views.py index ba1a62e..aa68925 100644 --- a/django_mapengine/views.py +++ b/django_mapengine/views.py @@ -1,9 +1,10 @@ """Views and mixins in order to use mapengine""" - +from django.apps import apps from django.conf import settings from django.http import JsonResponse from django.views.generic.base import ContextMixin +from django.core.exceptions import FieldDoesNotExist from . import __version__, layers, sources @@ -65,6 +66,48 @@ def get_context_data(self, **kwargs) -> dict: "choropleths": {choropleth.name: choropleth.as_dict() for choropleth in settings.MAP_ENGINE_CHOROPLETHS}, } + if settings.MAP_ENGINE_MAPLAYER_MODEL: + # get MapLayerModel from settings + try: + MapLayerModel = apps.get_model(app_label='map', model_name=settings.MAP_ENGINE_MAPLAYER_MODEL) + except ImportError: + raise LookupError("The MapLayerModel does not exist.") + + # get choropleth fields + try: + model_field = MapLayerModel._meta.get_field("choropleth_field") + except FieldDoesNotExist: + raise LookupError("Your MapLayerModel has no field named 'choropleth_field', which is mandatory.") + choropleths = MapLayerModel.objects.filter(choropleth_field__isnull=False).values_list("identifier", + "geom_layer") + store["choropleths"] = { + item[0]: {'layers': [item[1]], 'useFeatureState': True} + for item in choropleths + } + + # get popups + try: + model_field = MapLayerModel._meta.get_field("popup_fields") + except FieldDoesNotExist: + raise LookupError("Your MapLayerModel has no field named 'popup_fields', which is mandatory.") + + popups = MapLayerModel.objects.filter(popup_fields__isnull=False).values_list("identifier", "geom_layer") + transformed_popups = {} + for item in popups: + layer_id = item[1] + choropleth = item[0] + + if layer_id not in transformed_popups: + transformed_popups[layer_id] = { + 'layerID': layer_id, + 'atDefaultLayer': False, + 'choropleths': [] + } + + transformed_popups[layer_id]['choropleths'].append(choropleth) + + store["popups"] = transformed_popups + context["mapengine_store_cold_init"] = store return context From 2b25537b19803a5655e23564b464e3b6fe9b2bbc Mon Sep 17 00:00:00 2001 From: finnus <40977905+finnus@users.noreply.github.com> Date: Tue, 30 May 2023 11:00:35 +0200 Subject: [PATCH 25/27] add unit and name to choropleths --- django_mapengine/views.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/django_mapengine/views.py b/django_mapengine/views.py index aa68925..818be53 100644 --- a/django_mapengine/views.py +++ b/django_mapengine/views.py @@ -78,10 +78,15 @@ def get_context_data(self, **kwargs) -> dict: model_field = MapLayerModel._meta.get_field("choropleth_field") except FieldDoesNotExist: raise LookupError("Your MapLayerModel has no field named 'choropleth_field', which is mandatory.") - choropleths = MapLayerModel.objects.filter(choropleth_field__isnull=False).values_list("identifier", - "geom_layer") + choropleths = MapLayerModel.objects.filter(choropleth_field__isnull=False).values_list( + "identifier", "geom_layer", "choropleth_unit", "name") store["choropleths"] = { - item[0]: {'layers': [item[1]], 'useFeatureState': True} + item[0]: { + 'layers': [item[1]], + 'useFeatureState': True, + 'unit': [item[2]], + 'name': [item[3]] + } for item in choropleths } From 3c18c506b7afe91dda16fe9ecb051de46c9b0c17 Mon Sep 17 00:00:00 2001 From: finnus <40977905+finnus@users.noreply.github.com> Date: Thu, 1 Jun 2023 11:04:58 +0200 Subject: [PATCH 26/27] exclude blank choropleth_field --- django_mapengine/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_mapengine/views.py b/django_mapengine/views.py index 818be53..43960a2 100644 --- a/django_mapengine/views.py +++ b/django_mapengine/views.py @@ -78,7 +78,7 @@ def get_context_data(self, **kwargs) -> dict: model_field = MapLayerModel._meta.get_field("choropleth_field") except FieldDoesNotExist: raise LookupError("Your MapLayerModel has no field named 'choropleth_field', which is mandatory.") - choropleths = MapLayerModel.objects.filter(choropleth_field__isnull=False).values_list( + choropleths = MapLayerModel.objects.exclude(choropleth_field="").filter(choropleth_field__isnull=False).values_list( "identifier", "geom_layer", "choropleth_unit", "name") store["choropleths"] = { item[0]: { From d2cc9a16bb49cba7e627cb746e1d45921039b0f4 Mon Sep 17 00:00:00 2001 From: finnus <40977905+finnus@users.noreply.github.com> Date: Thu, 22 Jun 2023 13:29:57 +0200 Subject: [PATCH 27/27] change keyword to adapt to new legend --- django_mapengine/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_mapengine/views.py b/django_mapengine/views.py index 43960a2..98b2573 100644 --- a/django_mapengine/views.py +++ b/django_mapengine/views.py @@ -85,7 +85,7 @@ def get_context_data(self, **kwargs) -> dict: 'layers': [item[1]], 'useFeatureState': True, 'unit': [item[2]], - 'name': [item[3]] + 'title': [item[3]] } for item in choropleths }