From aac25d8d954eec47cb6211f58cb1f89d3bbc34d1 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 28 Nov 2023 18:51:16 +0100 Subject: 🐛 New Geo item form: center map widget on the center of the main geo item or use default center of the instance (#5676) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ishtar_common/views.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ishtar_common/views.py') diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 2ab7e970d..db493fd37 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -2938,6 +2938,9 @@ class GeoCreateView(GeoFormMixin, CreateView): kwargs["source_content_type"] = content_type.pk kwargs["source_id"] = obj.pk kwargs["geom_type"] = self.kwargs.get("geom_type") + main_geodata = obj.main_geodata + if main_geodata and main_geodata.cached_x and main_geodata.cached_y: + kwargs["default_center"] = (main_geodata.cached_x, main_geodata.cached_y) kwargs["user"] = self.request.user return kwargs -- cgit v1.2.3