Browse Source

Adicionando pagina web e email no arquivo csv

diagnosticos
Starlone (Estagiario) 14 years ago
parent
commit
93a288ddb4
  1. 14
      sigi/apps/casas/templates/casas/carrinho.html
  2. 10
      sigi/apps/casas/views.py

14
sigi/apps/casas/templates/casas/carrinho.html

@ -146,6 +146,18 @@
value="Telefone" class="action-select" checked="checked" />
<label>Telefone</label>
</li>
<li>
<span class="ui-icon ui-icon-arrowthick-2-n-s"></span>
<input type="checkbox" name="itens_csv_selected"
value="Página web" class="action-select" checked="checked" />
<label>Página Web</label>
</li>
<li>
<span class="ui-icon ui-icon-arrowthick-2-n-s"></span>
<input type="checkbox" name="itens_csv_selected"
value="Email" class="action-select" checked="checked" />
<label>Email</label>
</li>
</ul>
</fieldset>
<ul class="botoes">
@ -155,4 +167,4 @@
</div>
</div>
{% endblock %}
{% endblock %}

10
sigi/apps/casas/views.py

@ -258,8 +258,8 @@ def export_csv(request):
if request.POST:
atributos = request.POST.getlist("itens_csv_selected")
map(unicode,atributos)
csv_writer.writerow(atributos)
atributos2 = [s.encode("utf-8") for s in atributos]
csv_writer.writerow(atributos2)
for casa in casas:
lista = []
@ -271,7 +271,7 @@ def export_csv(request):
elif u"Nome" == atributo:
lista.append(casa.nome.encode("utf-8"))
elif u"Município" == atributo:
lista.append(str(casa.municipio).encode("utf-8"))
lista.append(str(casa.municipio))
elif u"Presidente" == atributo:
lista.append(casa.presidente.encode("utf-8"))
elif u"Logradouro" == atributo:
@ -282,6 +282,10 @@ def export_csv(request):
lista.append(casa.cep.encode("utf-8"))
elif u"Telefone" == atributo:
lista.append(casa.telefone.encode("utf-8"))
elif u"Página web" == atributo:
lista.append(casa.pagina_web.encode("utf-8"))
elif u"Email" == atributo:
lista.append(casa.email.encode("utf-8"))
else:
pass

Loading…
Cancel
Save