Browse Source

Correção de dict comprehension não suportada

stable/1.0
Sesostris Vieira 11 years ago
parent
commit
1869e15b4b
  1. 9
      sigi/apps/metas/views.py

9
sigi/apps/metas/views.py

@ -203,8 +203,13 @@ def map_list(request):
response['Content-Disposition'] = 'attachment; filename="maplist.csv"' response['Content-Disposition'] = 'attachment; filename="maplist.csv"'
writer = csv.writer(response) writer = csv.writer(response)
srv = {ts.pk: ts.nome for ts in TipoServico.objects.all()} srv = {}
cnv = {pr.id: pr.sigla for pr in Projeto.objects.all()} 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()] + 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()])) reduce(lambda x,y: x+y, [['conveniada ao %s' % x, 'equipada por %s' % x] for x in cnv.values()]))

Loading…
Cancel
Save