Skip to content

Commit

Permalink
Update views.rst (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasalexanderweber authored Feb 12, 2024
1 parent be2a1b5 commit a4a3cd0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/views.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit a4a3cd0

Please sign in to comment.