From a4a3cd0de7be6946d37b981d2b1b6bab71b53670 Mon Sep 17 00:00:00 2001 From: Lukas Weber <32765578+lukasalexanderweber@users.noreply.github.com> Date: Mon, 12 Feb 2024 09:23:29 +0100 Subject: [PATCH] Update views.rst (#122) --- docs/views.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/views.rst b/docs/views.rst index 7e0bb8f..ede3f4f 100644 --- a/docs/views.rst +++ b/docs/views.rst @@ -92,8 +92,9 @@ Mainly useful to dump features in HTML output and bypass AJAX call : :: // Leaflet JS - L.geoJson({{ object_list|geojsonfeature|safe}}).addTo(map); - + var raw_data = '{{ object_list|geojsonfeature|safe|escapejs }}'; + var data = JSON.parse(raw_data); + L.geoJSON(data).addTo(map); Will work either for a model, a geometry field or a queryset.