Browse Source

fix #1898 (#1917)

* Fix #1898

* Fix #1898

* Add "remover_acentos" to the sapl utils

* Remove the import unicodedata
pull/1923/head
Mariana Mendes 7 years ago
committed by Edward
parent
commit
0b4ead3270
  1. 4
      sapl/sessao/views.py
  2. 5
      sapl/utils.py

4
sapl/sessao/views.py

@ -34,7 +34,7 @@ from sapl.parlamentares.models import (Filiacao, Legislatura, Mandato,
Parlamentar, SessaoLegislativa)
from sapl.sessao.apps import AppConfig
from sapl.sessao.forms import ExpedienteMateriaForm, OrdemDiaForm
from sapl.utils import show_results_filter_set
from sapl.utils import show_results_filter_set, remover_acentos
from .forms import (AdicionarVariasMateriasFilterSet, BancadaForm, BlocoForm,
ExpedienteForm, ListMateriaForm, MesaForm,
@ -392,7 +392,7 @@ def get_presencas_generic(model, sessao, legislatura):
presentes = [p.parlamentar for p in presencas]
presentes = sorted(presentes, key=lambda x: x.nome_parlamentar)
presentes = sorted(presentes, key=lambda x: remover_acentos(x.nome_parlamentar))
mandato = Mandato.objects.filter(
legislatura=legislatura).order_by('parlamentar__nome_parlamentar')

5
sapl/utils.py

@ -2,6 +2,7 @@ import hashlib
import logging
import os
import re
import unicodedata
from functools import wraps
from operator import itemgetter
from unicodedata import normalize as unicodedata_normalize
@ -732,3 +733,7 @@ def RemoveTag(texto):
i += 1
return textoSaida
def remover_acentos(string):
return ''.join([c for c in unicodedata.normalize('NFD', string)
if unicodedata.category(c) != 'Mn'])
Loading…
Cancel
Save