Browse Source

Adicionando pagina web e email no arquivo csv

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

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

@ -146,6 +146,18 @@
value="Telefone" class="action-select" checked="checked" /> value="Telefone" class="action-select" checked="checked" />
<label>Telefone</label> <label>Telefone</label>
</li> </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> </ul>
</fieldset> </fieldset>
<ul class="botoes"> <ul class="botoes">

10
sigi/apps/casas/views.py

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

Loading…
Cancel
Save