Sistema de Informações Gerenciais do Interlegis
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
423 B

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"))