diff --git a/sapl/base/models.py b/sapl/base/models.py index 15e14e39c..0bf792ae4 100644 --- a/sapl/base/models.py +++ b/sapl/base/models.py @@ -1,18 +1,13 @@ +import reversion from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.db import models from django.db.models.signals import post_migrate from django.db.utils import DEFAULT_DB_ALIAS from django.utils.translation import ugettext_lazy as _ -import reversion - -from sapl.utils import ( - UF, - YES_NO_CHOICES, - get_settings_auth_user_model, - models_with_gr_for_model -) +from sapl.utils import (LISTA_DE_UFS, YES_NO_CHOICES, + get_settings_auth_user_model, models_with_gr_for_model) TIPO_DOCUMENTO_ADMINISTRATIVO = (('O', _('Ostensivo')), ('R', _('Restritivo'))) @@ -36,7 +31,7 @@ class CasaLegislativa(models.Model): cep = models.CharField(max_length=100, verbose_name=_('CEP')) municipio = models.CharField(max_length=100, verbose_name=_('MunicĂpio')) uf = models.CharField(max_length=100, - choices=UF, + choices=LISTA_DE_UFS, verbose_name=_('UF')) telefone = models.CharField( max_length=100, blank=True, verbose_name=_('Telefone')) diff --git a/sapl/parlamentares/models.py b/sapl/parlamentares/models.py index 2be2b79c7..c790dd874 100644 --- a/sapl/parlamentares/models.py +++ b/sapl/parlamentares/models.py @@ -7,7 +7,7 @@ from model_utils import Choices from sapl.base.models import Autor from sapl.decorators import vigencia_atual -from sapl.utils import (INDICADOR_AFASTAMENTO, UF, YES_NO_CHOICES, +from sapl.utils import (INDICADOR_AFASTAMENTO, LISTA_DE_UFS, YES_NO_CHOICES, SaplGenericRelation, get_settings_auth_user_model, intervalos_tem_intersecao, restringe_tipos_de_arquivo_img, texto_upload_path) @@ -155,7 +155,7 @@ class Municipio(models.Model): # Localidade nome = models.CharField(max_length=50, blank=True) uf = models.CharField( - max_length=2, blank=True, choices=UF) + max_length=2, blank=True, choices=LISTA_DE_UFS) regiao = models.CharField( max_length=2, blank=True, choices=REGIAO_CHOICES) diff --git a/sapl/relatorios/views.py b/sapl/relatorios/views.py index 07c2164ea..f4807c846 100644 --- a/sapl/relatorios/views.py +++ b/sapl/relatorios/views.py @@ -19,7 +19,7 @@ from sapl.sessao.models import (ExpedienteMateria, ExpedienteSessao, OrdemDia, PresencaOrdemDia, SessaoPlenaria, SessaoPlenariaPresenca) from sapl.settings import STATIC_ROOT -from sapl.utils import UF, filiacao_data, TrocaTag, ExtraiTag +from sapl.utils import LISTA_DE_UFS, ExtraiTag, TrocaTag, filiacao_data from .templates import (pdf_capa_processo_gerar, pdf_documento_administrativo_gerar, pdf_espelho_gerar, @@ -27,8 +27,6 @@ from .templates import (pdf_capa_processo_gerar, pdf_ordem_dia_gerar, pdf_pauta_sessao_gerar, pdf_protocolo_gerar, pdf_sessao_plenaria_gerar) -uf_dic = dict(UF) - def get_kwargs_params(request, fields): kwargs = {} @@ -46,8 +44,9 @@ def get_cabecalho(casa): cabecalho = {} cabecalho["nom_casa"] = casa.nome + uf_dict = dict(LISTA_DE_UFS) # FIXME i18n - cabecalho["nom_estado"] = "Estado de " + uf_dic[casa.uf.upper()] + cabecalho["nom_estado"] = "Estado de " + uf_dict[casa.uf.upper()] return cabecalho @@ -745,11 +744,11 @@ def get_turno(dic, materia, sessao_data_inicio): data_tramitacao__lte=sessao_data_inicio, ).exclude(turno__exact='' ).select_related( - 'materia', - 'status', - 'materia__tipo').order_by( - '-data_tramitacao' - ).first() + 'materia', + 'status', + 'materia__tipo').order_by( + '-data_tramitacao' + ).first() if tramitacao is not None: for t in Tramitacao.TURNO_CHOICES: if t[0] == tramitacao.turno: @@ -792,15 +791,11 @@ def relatorio_sessao_plenaria(request, pk): lst_votacao, lst_oradores) = get_sessao_plenaria(sessao, casa) - for idx in range(len(lst_expedientes)): txt_expedientes = lst_expedientes[idx]['txt_expediente'] txt_expedientes = TrocaTag(txt_expedientes, '