From 0abffff6e35b50829bd3f6151f5bd7bb144e4eee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Tue, 22 Oct 2013 12:33:53 -0200 Subject: [PATCH] =?UTF-8?q?Acrescentado=20campo=20UF=20na=20exporta=C3=A7?= =?UTF-8?q?=C3=A3o=20de=20conv=C3=AAnios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/apps/convenios/views.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sigi/apps/convenios/views.py b/sigi/apps/convenios/views.py index ead132a..2f2a6d7 100644 --- a/sigi/apps/convenios/views.py +++ b/sigi/apps/convenios/views.py @@ -292,10 +292,17 @@ def export_csv(request): if not convenios: return HttpResponseRedirect('../') + atributos = [ u"No. Processo", u"No. Convênio", u"Projeto", u"Casa Legislativa", u"Data de Adesão", u"Data de Convênio", + u"Data da Publicacao no D.O.", u"Data Equipada", ] + if request.POST: atributos = request.POST.getlist("itens_csv_selected") - atributos2 = [s.encode("utf-8") for s in atributos] - csv_writer.writerow(atributos2) + + col_titles = atributos + if u"Casa Legislativa" in col_titles: + pos = col_titles.index(u"Casa Legislativa") + 1 + col_titles.insert(pos, u"uf") + csv_writer.writerow([s.encode("utf-8") for s in col_titles]) for convenio in convenios: lista = [] @@ -308,6 +315,7 @@ def export_csv(request): lista.append(convenio.projeto.nome.encode("utf-8")) elif u"Casa Legislativa" == atributo: lista.append(convenio.casa_legislativa.nome.encode("utf-8")) + lista.append(convenio.casa_legislativa.municipio.uf.sigla.encode("utf-8")) elif u"Data de Adesão" == atributo: data = '' if convenio.data_adesao: