def display(request):
boundary_detail = Butuan_City.objects.filter(id=1)
dif = Django.Django(geodjango = 'geometry', properties=['NewPin'])
geoj = GeoJSON.GeoJSON()
s = geoj.encode(dif.decode(boundary_detail))
return render_to_response('index.html', {'places': s})
This is the index.html that render and display the converted geojson object as text.
<html>
{% load leaflet_tags %}
<head>
{% leaflet_js plugins="ALL" %}
{% leaflet_css plugins="ALL" %}
{% leaflet_js %}
{% leaflet_css %}
</head>
<style>
.leaflet-container { /* all maps */
width: 50%;
height: 50%;
}
#specialbigmap {
height: 800px;
}
</style>
<body>
<script type="text/javascript">
window.addEventListener("map:init", function (e) {
var detail = e.detail;
L.marker([50.5, 30.5]).addTo(detail.map);
}, false);
</script>
{% leaflet_map "map" callback="window.map_init_basic" %}
</br>
</br>
<h4>{{ places }}</h4>
</body>
</html>