From 4e56495a4c27a80036a858f2b926dc38f67a17ae Mon Sep 17 00:00:00 2001 From: Sesostris Vieira Date: Wed, 31 Oct 2012 14:42:02 +0000 Subject: [PATCH] Adiciona mapa com plotagem das Casas que foram diagnosticadas. - complemento --- sigi/apps/diagnosticos/views.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sigi/apps/diagnosticos/views.py b/sigi/apps/diagnosticos/views.py index c7b6101..555aad1 100644 --- a/sigi/apps/diagnosticos/views.py +++ b/sigi/apps/diagnosticos/views.py @@ -331,3 +331,13 @@ def grafico_api(request): json = simplejson.dumps(response) return HttpResponse(json, mimetype="application/json") +def municipios_diagnosticados(self): + municipios = [] + + for d in Diagnostico.objects.all(): + m = d.casa_legislativa.municipio + municipio = {'nome': d.casa_legislativa.nome + ', ' + m.uf.sigla, 'lat': str(m.latitude), 'lng': str(m.longitude), 'inicio': d.data_visita_inicio.strftime('%d/%m/%Y'), + 'fim': d.data_visita_fim.strftime('%d/%m/%Y'), 'equipe': "",} + municipios.append(municipio) + + return HttpResponse(simplejson.dumps(municipios), mimetype="application/json") \ No newline at end of file