Django creates a file named views.py , in which I have the following function:
def carro_view(request,carro_slug=None):
evento = Evento.objects.filter(time = '11:28:30').distinct()
data = []
for x in evento:
data.append({
"latitude": x.lat.replace(',', '.'),
"longitude": x.lon.replace(',', '.'),
"title": x.carro
})
marker = {"markers": data }
return HttpResponse(json.dumps(marker), content_type="application/json")
I would like to know how I could get this JSON into a JS file, I know there is getJSON(url, function(data))
, but in what way I could use this to retrieve the function return in views.py in> ??