From 1869e15b4b35adc081eda18f29e7f4d0a5ecf10e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Tue, 22 Oct 2013 14:59:35 -0200 Subject: [PATCH] =?UTF-8?q?Corre=C3=A7=C3=A3o=20de=20dict=20comprehension?= =?UTF-8?q?=20n=C3=A3o=20suportada?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/apps/metas/views.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sigi/apps/metas/views.py b/sigi/apps/metas/views.py index 21e66ed..231bad1 100644 --- a/sigi/apps/metas/views.py +++ b/sigi/apps/metas/views.py @@ -203,8 +203,13 @@ def map_list(request): response['Content-Disposition'] = 'attachment; filename="maplist.csv"' writer = csv.writer(response) - srv = {ts.pk: ts.nome for ts in TipoServico.objects.all()} - cnv = {pr.id: pr.sigla for pr in Projeto.objects.all()} + srv = {} + for ts in TipoServico.objects.all(): + srv[ts.pk] = ts.nome + + cnv = {} + for pr in Projeto.objects.all(): + cnv[pr.id] = pr.sigla writer.writerow([u'codigo_ibge', u'nome_casa', u'municipio', u'uf', u'regiao',] + [x for x in srv.values()] + reduce(lambda x,y: x+y, [['conveniada ao %s' % x, 'equipada por %s' % x] for x in cnv.values()]))