From 6529d39eca9a0c6a2dbdaf88b482d7bf97172725 Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Thu, 14 May 2015 16:24:02 -0300 Subject: [PATCH] Add ad-hoc script to list portal modelo's urls --- scripts/urls de portais modelo por estado municipio.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 scripts/urls de portais modelo por estado municipio.py diff --git a/scripts/urls de portais modelo por estado municipio.py b/scripts/urls de portais modelo por estado municipio.py new file mode 100644 index 0000000..f8908bb --- /dev/null +++ b/scripts/urls de portais modelo por estado municipio.py @@ -0,0 +1,8 @@ +from sigi.apps.servicos.models import TipoServico + +pm = TipoServico.objects.first() +res = sorted([(p.casa_legislativa.municipio.uf, p.casa_legislativa.municipio.nome, p.url) for p in pm.servico_set.all()]) + +with open('/tmp/pm.csv', 'w+') as f: + for uf, cid, url in res: + f.write(('%s,%s,%s' % (uf.nome, cid, url) + '\n').encode('utf-8'))