From 4cae976a9152e98ad165f58129f6eca41fc9bee2 Mon Sep 17 00:00:00 2001 From: LeandroJatai Date: Mon, 15 Jul 2024 22:19:26 -0300 Subject: [PATCH] fix: ugettext_lazy to gettext_lazy --- drfautoapi/drfautoapi.py | 2 +- sapl/api/apps.py | 2 +- sapl/api/forms.py | 2 +- sapl/audiencia/apps.py | 4 +- sapl/audiencia/forms.py | 2 +- sapl/audiencia/models.py | 2 +- sapl/base/admin.py | 2 +- sapl/base/apps.py | 2 +- sapl/base/email_utils.py | 2 +- sapl/base/forms.py | 4 +- sapl/base/models.py | 2 +- sapl/base/receivers.py | 2 +- sapl/base/templatetags/menus.py | 6 +- sapl/base/tests/test_form.py | 2 +- sapl/base/tests/test_view_base.py | 6 +- sapl/base/views.py | 2 +- sapl/comissoes/apps.py | 2 +- sapl/comissoes/forms.py | 8 +-- sapl/comissoes/models.py | 2 +- sapl/comissoes/views.py | 20 +++--- sapl/compilacao/apps.py | 2 +- sapl/compilacao/forms.py | 2 +- sapl/compilacao/models.py | 2 +- .../templatetags/compilacao_filters.py | 2 +- sapl/compilacao/views.py | 34 +++++----- sapl/context_processors.py | 2 +- sapl/crud/base.py | 2 +- sapl/decorators.py | 2 +- sapl/lexml/apps.py | 2 +- sapl/lexml/forms.py | 2 +- sapl/lexml/models.py | 2 +- sapl/materia/apps.py | 2 +- sapl/materia/forms.py | 2 +- sapl/materia/models.py | 4 +- sapl/materia/views.py | 2 +- sapl/norma/apps.py | 2 +- sapl/norma/forms.py | 2 +- sapl/norma/models.py | 2 +- sapl/norma/tests/test_norma.py | 2 +- sapl/norma/views.py | 2 +- sapl/painel/apps.py | 2 +- sapl/painel/models.py | 2 +- sapl/painel/views.py | 12 ++-- sapl/parlamentares/apps.py | 2 +- sapl/parlamentares/forms.py | 2 +- sapl/parlamentares/models.py | 2 +- .../parlamentares/tests/test_parlamentares.py | 4 +- sapl/parlamentares/views.py | 2 +- sapl/protocoloadm/apps.py | 2 +- sapl/protocoloadm/forms.py | 10 +-- sapl/protocoloadm/models.py | 2 +- sapl/protocoloadm/tests/test_protocoloadm.py | 66 +++++++++---------- sapl/protocoloadm/views.py | 2 +- sapl/redireciona_urls/apps.py | 2 +- sapl/relatorios/apps.py | 2 +- sapl/relatorios/forms.py | 2 +- sapl/relatorios/views.py | 2 +- sapl/rules/__init__.py | 2 +- sapl/rules/apps.py | 2 +- sapl/rules/tests/test_rules.py | 2 +- sapl/sessao/apps.py | 2 +- sapl/sessao/forms.py | 2 +- sapl/sessao/models.py | 2 +- sapl/sessao/tests/test_sessao.py | 2 +- sapl/sessao/tests/test_sessao_view.py | 16 ++--- sapl/sessao/views.py | 2 +- sapl/test_urls.py | 2 +- sapl/utils.py | 2 +- 68 files changed, 152 insertions(+), 152 deletions(-) diff --git a/drfautoapi/drfautoapi.py b/drfautoapi/drfautoapi.py index e0fd0c348..ba0c4decb 100644 --- a/drfautoapi/drfautoapi.py +++ b/drfautoapi/drfautoapi.py @@ -12,7 +12,7 @@ from django.db.models.base import ModelBase from django.db.models.fields import TextField, CharField from django.db.models.fields.files import FileField from django.template.defaultfilters import capfirst -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ import django_filters from django_filters.constants import ALL_FIELDS, EMPTY_VALUES from django_filters.filters import CharFilter diff --git a/sapl/api/apps.py b/sapl/api/apps.py index f8adf670b..eb66f400b 100644 --- a/sapl/api/apps.py +++ b/sapl/api/apps.py @@ -1,5 +1,5 @@ from django import apps -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class AppConfig(apps.AppConfig): diff --git a/sapl/api/forms.py b/sapl/api/forms.py index 79238f873..995d9d962 100644 --- a/sapl/api/forms.py +++ b/sapl/api/forms.py @@ -2,7 +2,7 @@ import logging from django.db.models import Q from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django_filters.filters import CharFilter, DateFilter, ModelChoiceFilter from django_filters.filterset import FilterSet from rest_framework import serializers diff --git a/sapl/audiencia/apps.py b/sapl/audiencia/apps.py index e9b3c890f..1b64f9656 100644 --- a/sapl/audiencia/apps.py +++ b/sapl/audiencia/apps.py @@ -1,8 +1,8 @@ from django import apps -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class AppConfig(apps.AppConfig): name = 'sapl.audiencia' label = 'audiencia' - verbose_name = _('Audiência Pública') \ No newline at end of file + verbose_name = _('Audiência Pública') diff --git a/sapl/audiencia/forms.py b/sapl/audiencia/forms.py index 211db9855..9629ccf40 100755 --- a/sapl/audiencia/forms.py +++ b/sapl/audiencia/forms.py @@ -5,7 +5,7 @@ from datetime import datetime from django import forms from django.core.exceptions import ObjectDoesNotExist, ValidationError from django.db import transaction -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from crispy_forms.layout import Button, Column, Fieldset, HTML, Layout diff --git a/sapl/audiencia/models.py b/sapl/audiencia/models.py index e5d011762..1b265140c 100755 --- a/sapl/audiencia/models.py +++ b/sapl/audiencia/models.py @@ -1,6 +1,6 @@ from django.db import models from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from model_utils import Choices from sapl.materia.models import MateriaLegislativa from sapl.parlamentares.models import (CargoMesa, Parlamentar) diff --git a/sapl/base/admin.py b/sapl/base/admin.py index c7df7ca63..9289254b3 100644 --- a/sapl/base/admin.py +++ b/sapl/base/admin.py @@ -1,6 +1,6 @@ from django.contrib import admin from django.shortcuts import redirect -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from sapl.base.models import AuditLog from sapl.utils import register_all_models_in_admin diff --git a/sapl/base/apps.py b/sapl/base/apps.py index 403d74bd1..b362fbda3 100644 --- a/sapl/base/apps.py +++ b/sapl/base/apps.py @@ -1,6 +1,6 @@ import django -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class AppConfig(django.apps.AppConfig): diff --git a/sapl/base/email_utils.py b/sapl/base/email_utils.py index 3ccf64690..95d51281c 100644 --- a/sapl/base/email_utils.py +++ b/sapl/base/email_utils.py @@ -11,7 +11,7 @@ from sapl.materia.models import AcompanhamentoMateria from sapl.protocoloadm.models import AcompanhamentoDocumento from sapl.settings import EMAIL_SEND_USER from sapl.utils import mail_service_configured -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ def load_email_templates(templates, context={}): diff --git a/sapl/base/forms.py b/sapl/base/forms.py index 092206429..802838889 100644 --- a/sapl/base/forms.py +++ b/sapl/base/forms.py @@ -16,7 +16,7 @@ from django.db.models import Q from django.forms import Form, ModelForm from django.utils import timezone from django.utils.safestring import mark_safe -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ import django_filters from haystack.forms import ModelSearchForm @@ -313,7 +313,7 @@ class UserAdminForm(ModelForm): ) """ - + if 'email' in data and data['email']: duplicidade = get_user_model().objects.filter(email=data['email']) if self.instance.id: diff --git a/sapl/base/models.py b/sapl/base/models.py index e0f00bbf2..7f33a0623 100644 --- a/sapl/base/models.py +++ b/sapl/base/models.py @@ -7,7 +7,7 @@ from django.db import models from django.db.models.deletion import CASCADE from django.db.models.signals import post_migrate from django.db.utils import DEFAULT_DB_ALIAS -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from sapl.utils import (LISTA_DE_UFS, YES_NO_CHOICES, get_settings_auth_user_model, models_with_gr_for_model) diff --git a/sapl/base/receivers.py b/sapl/base/receivers.py index 595323197..82adfa9cf 100644 --- a/sapl/base/receivers.py +++ b/sapl/base/receivers.py @@ -14,7 +14,7 @@ from django.db.models.signals import post_delete, post_save, \ from django.db.utils import DEFAULT_DB_ALIAS from django.dispatch import receiver from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from sapl.base.email_utils import do_envia_email_tramitacao from sapl.base.models import AuditLog, TipoAutor, Autor, Metadata diff --git a/sapl/base/templatetags/menus.py b/sapl/base/templatetags/menus.py index 65ecdcfec..9ff123da9 100644 --- a/sapl/base/templatetags/menus.py +++ b/sapl/base/templatetags/menus.py @@ -2,7 +2,7 @@ import logging from django import template from django.urls import reverse -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ import yaml @@ -145,7 +145,7 @@ def resolve_urls_inplace(menu, pk, rm, context): Erro na construção do Menu: menu: {} url: {} - 1) Verifique se a url existe + 1) Verifique se a url existe 2) Se existe no contexto um desses itens: - context['root_pk'] pk do master - context['object'] objeto do master @@ -165,7 +165,7 @@ def resolve_urls_inplace(menu, pk, rm, context): log = """Erro na construção do Menu: menu: {} url: {} - 1) Verifique se a url existe + 1) Verifique se a url existe 2) Se existe no contexto um desses itens: - context['root_pk'] pk do master - context['object'] objeto do master diff --git a/sapl/base/tests/test_form.py b/sapl/base/tests/test_form.py index 35f1c82bf..d6a8c4b25 100644 --- a/sapl/base/tests/test_form.py +++ b/sapl/base/tests/test_form.py @@ -1,5 +1,5 @@ import pytest -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from sapl.base.forms import CasaLegislativaForm diff --git a/sapl/base/tests/test_view_base.py b/sapl/base/tests/test_view_base.py index 3a38d379c..b9cac78c3 100644 --- a/sapl/base/tests/test_view_base.py +++ b/sapl/base/tests/test_view_base.py @@ -2,7 +2,7 @@ import pytest from model_bakery import baker import datetime from django.urls import reverse -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from model_bakery import baker from sapl.base.models import Autor, TipoAutor @@ -404,7 +404,7 @@ def test_lista_anexados_ciclicas(): sigla="TT", descricao="Tipo_Teste" ) - + documento_a = baker.make( DocumentoAdministrativo, tipo=tipo_documento, @@ -550,7 +550,7 @@ def test_lista_anexados_ciclicas(): data_apresentacao="2019-05-08", regime_tramitacao=regime_tramitacao, tipo=tipo_materia - ) + ) baker.make( Anexada, diff --git a/sapl/base/views.py b/sapl/base/views.py index 8417c0021..8eb8b8bc6 100644 --- a/sapl/base/views.py +++ b/sapl/base/views.py @@ -24,7 +24,7 @@ from django.utils import timezone from django.utils.decorators import method_decorator from django.utils.encoding import force_bytes from django.utils.http import urlsafe_base64_decode, urlsafe_base64_encode -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.views.generic import (FormView, ListView) from django.views.generic.base import RedirectView, TemplateView from django_filters.views import FilterView diff --git a/sapl/comissoes/apps.py b/sapl/comissoes/apps.py index 18cb03041..49a63c70c 100644 --- a/sapl/comissoes/apps.py +++ b/sapl/comissoes/apps.py @@ -1,5 +1,5 @@ from django import apps -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class AppConfig(apps.AppConfig): diff --git a/sapl/comissoes/forms.py b/sapl/comissoes/forms.py index 76f511ed2..5084e020c 100644 --- a/sapl/comissoes/forms.py +++ b/sapl/comissoes/forms.py @@ -9,7 +9,7 @@ from django.core.exceptions import ValidationError from django.db import transaction from django.db.models import Q from django.forms import ModelForm -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.utils import timezone from sapl.base.models import Autor, TipoAutor @@ -443,10 +443,10 @@ class ReuniaoForm(ModelForm): if upload_pauta: validar_arquivo(upload_pauta, "Pauta da Reunião") - + if upload_ata: validar_arquivo(upload_ata, "Ata da Reunião") - + if upload_anexo: validar_arquivo(upload_anexo, "Anexo da Reunião") @@ -474,7 +474,7 @@ class PautaReuniaoFilterSet(django_filters.FilterSet): self.form.helper.form_method = "GET" self.form.helper.layout = Layout( Fieldset( - _("Pesquisa de Matérias"), row1, row2, + _("Pesquisa de Matérias"), row1, row2, form_actions(label="Pesquisar") ) ) diff --git a/sapl/comissoes/models.py b/sapl/comissoes/models.py index 2d9a323d3..0245a2d8a 100644 --- a/sapl/comissoes/models.py +++ b/sapl/comissoes/models.py @@ -1,5 +1,5 @@ from django.db import models -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from model_utils import Choices from sapl.base.models import Autor diff --git a/sapl/comissoes/views.py b/sapl/comissoes/views.py index 5d3e450c2..d95fb3223 100644 --- a/sapl/comissoes/views.py +++ b/sapl/comissoes/views.py @@ -10,7 +10,7 @@ from django.views.generic import CreateView, DeleteView, FormView, ListView from django.views.generic.base import RedirectView from django.views.generic.detail import DetailView from django.views.generic.edit import FormMixin, UpdateView -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django_filters.views import FilterView @@ -19,7 +19,7 @@ from sapl.comissoes.apps import AppConfig from sapl.comissoes.forms import (ComissaoForm, ComposicaoForm, DocumentoAcessorioCreateForm, DocumentoAcessorioEditForm, - ParticipacaoCreateForm, + ParticipacaoCreateForm, ParticipacaoEditForm, PautaReuniaoFilterSet, PautaReuniaoForm, PeriodoForm, ReuniaoForm) @@ -186,7 +186,7 @@ def lista_materias_comissao(comissao_pk): materias = MateriaEmTramitacao.objects.filter( tramitacao__unidade_tramitacao_destino__comissao=comissao_pk ).order_by('materia__tipo', '-materia__ano', '-materia__numero') - + return materias @@ -229,14 +229,14 @@ class ReuniaoCrud(MasterDetailCrud): mats = [] materias_pauta = PautaReuniao.objects.filter(reuniao=self.kwargs['pk']) materias_pk = [materia_pauta.materia.pk for materia_pauta in materias_pauta] - + context['mats'] = MateriaLegislativa.objects.filter( pk__in=materias_pk ).order_by('tipo', '-ano', 'numero') context['num_mats'] = len(context['mats']) context['reuniao_pk'] = self.kwargs['pk'] - + return context class ListView(MasterDetailCrud.ListView): @@ -307,7 +307,7 @@ class RemovePautaView(PermissionRequiredMixin, CreateView): materias_pauta = PautaReuniao.objects.filter(reuniao=context['object']) materias_pk = [materia_pauta.materia.pk for materia_pauta in materias_pauta] - + context['materias'] = MateriaLegislativa.objects.filter( pk__in=materias_pk ).order_by('tipo', '-ano', 'numero') @@ -366,16 +366,16 @@ class AdicionaPautaView(PermissionRequiredMixin, FilterView): context['show_results'] = show_results_filter_set(qr) return context - + def post(self, request, *args, **kwargs): - success_url = reverse('sapl.comissoes:reuniao_detail', kwargs={'pk':kwargs['pk']}) + success_url = reverse('sapl.comissoes:reuniao_detail', kwargs={'pk':kwargs['pk']}) marcadas = request.POST.getlist('materia_id') if not marcadas: msg = _('Nenhuma máteria foi selecionada.') messages.add_message(request, messages.WARNING, msg) return HttpResponseRedirect(success_url) - + reuniao = Reuniao.objects.get(pk=kwargs['pk']) pautas = [] for materia in MateriaLegislativa.objects.filter(id__in=marcadas): @@ -384,7 +384,7 @@ class AdicionaPautaView(PermissionRequiredMixin, FilterView): pauta.materia = materia pautas.append(pauta) PautaReuniao.objects.bulk_create(pautas) - + msg = _('Matéria(s) adicionada(s) com sucesso!') messages.add_message(request, messages.SUCCESS, msg) return HttpResponseRedirect(success_url) diff --git a/sapl/compilacao/apps.py b/sapl/compilacao/apps.py index 0e8105a64..f786fb36b 100644 --- a/sapl/compilacao/apps.py +++ b/sapl/compilacao/apps.py @@ -3,7 +3,7 @@ from django import apps from django.conf import settings from django.db import connection, models from django.db.utils import DEFAULT_DB_ALIAS, IntegrityError -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class AppConfig(apps.AppConfig): diff --git a/sapl/compilacao/forms.py b/sapl/compilacao/forms.py index 18c24cf1f..3423cc7e8 100644 --- a/sapl/compilacao/forms.py +++ b/sapl/compilacao/forms.py @@ -12,7 +12,7 @@ from django.forms import widgets from django.forms.forms import Form from django.forms.models import ModelForm from django.template import defaultfilters -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from image_cropping.widgets import CropWidget, ImageCropWidget from model_utils.choices import Choices diff --git a/sapl/compilacao/models.py b/sapl/compilacao/models.py index 783e28ce0..da5d6b8b0 100644 --- a/sapl/compilacao/models.py +++ b/sapl/compilacao/models.py @@ -10,7 +10,7 @@ from django.template import defaultfilters from django.utils import timezone from django.utils.decorators import classonlymethod from django.utils.encoding import force_text -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from image_cropping.fields import ImageCropField, ImageRatioField from sapl.compilacao.utils import (get_integrations_view_names, int_to_letter, diff --git a/sapl/compilacao/templatetags/compilacao_filters.py b/sapl/compilacao/templatetags/compilacao_filters.py index cc21b8eb7..0e8d896ae 100644 --- a/sapl/compilacao/templatetags/compilacao_filters.py +++ b/sapl/compilacao/templatetags/compilacao_filters.py @@ -3,7 +3,7 @@ from django import template from django.core.signing import Signer from django.db.models import Q from django.utils.safestring import mark_safe -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from sapl.compilacao.models import Dispositivo diff --git a/sapl/compilacao/views.py b/sapl/compilacao/views.py index 9afbe3201..da6b2c7c0 100644 --- a/sapl/compilacao/views.py +++ b/sapl/compilacao/views.py @@ -22,7 +22,7 @@ from django.shortcuts import get_object_or_404, redirect from django.urls import reverse, reverse_lazy from django.utils.dateparse import parse_date from django.utils.encoding import force_text -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.views.generic.base import TemplateView from django.views.generic.detail import DetailView from django.views.generic.edit import (CreateView, DeleteView, FormView, @@ -1956,7 +1956,7 @@ class ActionDeleteDispositivoMixin(ActionsCommonsMixin): continua internos extra bloco. Depois do bloco limpo, a função é chamada novamente para excluir realmente a escolha do usuário - e religar seus irmaos + e religar seus irmaos """ self.remover_dispositivo(base, False) @@ -3225,14 +3225,14 @@ class DispositivoSearchFragmentFormView(ListView): AND_CONTROLS = 'AND td.dispositivo_de_alteracao = false' else: if df == 'alterador': - AND_CONTROLS = '''AND td.dispositivo_de_alteracao = true + AND_CONTROLS = '''AND td.dispositivo_de_alteracao = true AND td.dispositivo_de_articulacao = true''' texto = list(map("d.texto ~* '{}'".format, texto)) AND_TEXTO_ROTULO = '' if str_texto and rotulo: AND_TEXTO_ROTULO = '''AND ( ({BUSCA_TEXTO} AND d.rotulo ~* '{BUSCA_ROTULO}') OR - ({BUSCA_TEXTO} AND d.rotulo = '' AND dp.rotulo ~* '{BUSCA_ROTULO}') + ({BUSCA_TEXTO} AND d.rotulo = '' AND dp.rotulo ~* '{BUSCA_ROTULO}') )'''.format( BUSCA_TEXTO=' AND '.join(texto), BUSCA_ROTULO=rotulo @@ -3255,29 +3255,29 @@ class DispositivoSearchFragmentFormView(ListView): gfk_field_type_id=tipo_model.id, ) - sql = ''' - SELECT d.* FROM compilacao_dispositivo d + sql = ''' + SELECT d.* FROM compilacao_dispositivo d JOIN compilacao_dispositivo dp on (d.dispositivo_pai_id = dp.id) JOIN compilacao_tipodispositivo td on (d.tipo_dispositivo_id = td.id) - JOIN compilacao_textoarticulado ta on (d.ta_id = ta.id) - + JOIN compilacao_textoarticulado ta on (d.ta_id = ta.id) + {JOIN_TYPE_MODEL_SELECTED} - + where d.nivel > 0 - + {AND_TYPE_MODEL_SELECTED} - + {AND_TEXTO_ROTULO} {AND1_NUMERO} {AND2_ANO} {AND3_TIPO_TA} {AND_CONTROLS} - - order by ta.data desc, - ta.numero desc, - ta.id desc, - d.ordem - {limit}; + + order by ta.data desc, + ta.numero desc, + ta.id desc, + d.ordem + {limit}; '''.format( limit='limit {}'.format(limit) if limit else '', diff --git a/sapl/context_processors.py b/sapl/context_processors.py index 2b8a422cb..9c9adbc5a 100644 --- a/sapl/context_processors.py +++ b/sapl/context_processors.py @@ -1,7 +1,7 @@ import logging from django.conf import settings -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from sapl.utils import google_recaptcha_configured as google_recaptcha_configured_utils, sapn_is_enabled from sapl.utils import mail_service_configured as mail_service_configured_utils diff --git a/sapl/crud/base.py b/sapl/crud/base.py index 7c2eb4c6c..875c76c88 100644 --- a/sapl/crud/base.py +++ b/sapl/crud/base.py @@ -16,7 +16,7 @@ from django.shortcuts import redirect from django.urls import reverse from django.utils.decorators import classonlymethod from django.utils.encoding import force_text -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.views.generic import (CreateView, DeleteView, DetailView, ListView, UpdateView) from django.views.generic.base import ContextMixin diff --git a/sapl/decorators.py b/sapl/decorators.py index a377c954b..7f7ca14e6 100644 --- a/sapl/decorators.py +++ b/sapl/decorators.py @@ -1,7 +1,7 @@ from functools import wraps from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ def vigencia_atual(decorated_method): diff --git a/sapl/lexml/apps.py b/sapl/lexml/apps.py index 3a8bb3c72..25982c489 100644 --- a/sapl/lexml/apps.py +++ b/sapl/lexml/apps.py @@ -1,5 +1,5 @@ from django import apps -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class AppConfig(apps.AppConfig): diff --git a/sapl/lexml/forms.py b/sapl/lexml/forms.py index 7904508af..8ac7e8a2b 100644 --- a/sapl/lexml/forms.py +++ b/sapl/lexml/forms.py @@ -1,7 +1,7 @@ from django.core.exceptions import ValidationError from django.forms import ModelForm from sapl.settings import PROJECT_DIR -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from io import StringIO from lxml import etree diff --git a/sapl/lexml/models.py b/sapl/lexml/models.py index 1a5d27144..7218e974d 100644 --- a/sapl/lexml/models.py +++ b/sapl/lexml/models.py @@ -1,5 +1,5 @@ from django.db import models -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class LexmlProvedor(models.Model): # LexmlRegistroProvedor diff --git a/sapl/materia/apps.py b/sapl/materia/apps.py index 3ac053d1b..a8ee2425d 100644 --- a/sapl/materia/apps.py +++ b/sapl/materia/apps.py @@ -1,5 +1,5 @@ from django import apps -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class AppConfig(apps.AppConfig): diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py index ce1b41da7..074150961 100644 --- a/sapl/materia/forms.py +++ b/sapl/materia/forms.py @@ -15,7 +15,7 @@ from django.forms.models import ModelMultipleChoiceField from django.forms.widgets import CheckboxSelectMultiple, HiddenInput, Select from django.urls import reverse from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ import django_filters from sapl.base.models import AppConfig as BaseAppConfig, Autor, TipoAutor diff --git a/sapl/materia/models.py b/sapl/materia/models.py index 4628695ee..8fc3eaeb2 100644 --- a/sapl/materia/models.py +++ b/sapl/materia/models.py @@ -8,7 +8,7 @@ from django.db import models from django.db.models.functions import Concat from django.template import defaultfilters from django.utils import formats, timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from model_utils import Choices from sapl.base.models import SEQUENCIA_NUMERACAO_PROTOCOLO, Autor @@ -934,7 +934,7 @@ class Proposicao(models.Model): """ Ao ser recebida, irá gerar uma nova matéria ou um documento acessorio de uma já existente - + materia_gerada = models.ForeignKey( MateriaLegislativa, blank=True, diff --git a/sapl/materia/views.py b/sapl/materia/views.py index d6742c00a..c8239c38f 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -25,7 +25,7 @@ from django.template import loader from django.urls import reverse from django.utils import formats, timezone from django.utils.encoding import force_text -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.views.generic import CreateView, ListView, TemplateView, UpdateView from django.views.generic.base import RedirectView from django.views.generic.edit import FormView diff --git a/sapl/norma/apps.py b/sapl/norma/apps.py index effd4f271..593a172fa 100644 --- a/sapl/norma/apps.py +++ b/sapl/norma/apps.py @@ -1,5 +1,5 @@ from django import apps -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class AppConfig(apps.AppConfig): diff --git a/sapl/norma/forms.py b/sapl/norma/forms.py index 53f88c141..1da443981 100644 --- a/sapl/norma/forms.py +++ b/sapl/norma/forms.py @@ -7,7 +7,7 @@ from django.core.exceptions import ObjectDoesNotExist, ValidationError from django.db.models import Q from django.forms import ModelChoiceField, ModelForm, widgets from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ import django_filters from sapl.base.models import TipoAutor diff --git a/sapl/norma/models.py b/sapl/norma/models.py index cd8a81745..548ec0e7d 100644 --- a/sapl/norma/models.py +++ b/sapl/norma/models.py @@ -2,7 +2,7 @@ from django.contrib.contenttypes.fields import GenericRelation from django.db import models from django.template import defaultfilters from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from model_utils import Choices from sapl.base.models import Autor diff --git a/sapl/norma/tests/test_norma.py b/sapl/norma/tests/test_norma.py index 52f810b91..2b8cdfa3c 100644 --- a/sapl/norma/tests/test_norma.py +++ b/sapl/norma/tests/test_norma.py @@ -1,5 +1,5 @@ from django.urls import reverse -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from model_bakery import baker import pytest diff --git a/sapl/norma/views.py b/sapl/norma/views.py index ce5c1a365..668069a2f 100644 --- a/sapl/norma/views.py +++ b/sapl/norma/views.py @@ -13,7 +13,7 @@ from django.urls import reverse from django.urls.base import reverse_lazy from django.utils import timezone from django.utils.encoding import force_text -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.views.generic import TemplateView, UpdateView from django.views.generic.edit import FormView from django_filters.views import FilterView diff --git a/sapl/painel/apps.py b/sapl/painel/apps.py index 7cd1002ec..e44c55f55 100644 --- a/sapl/painel/apps.py +++ b/sapl/painel/apps.py @@ -1,5 +1,5 @@ from django import apps -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class AppConfig(apps.AppConfig): diff --git a/sapl/painel/models.py b/sapl/painel/models.py index 8a178e6c2..fb3de6a2b 100644 --- a/sapl/painel/models.py +++ b/sapl/painel/models.py @@ -1,5 +1,5 @@ from django.db import models -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class Painel(models.Model): diff --git a/sapl/painel/views.py b/sapl/painel/views.py index a4c9e2da3..268a36057 100644 --- a/sapl/painel/views.py +++ b/sapl/painel/views.py @@ -11,7 +11,7 @@ from django.http import HttpResponse, JsonResponse from django.http.response import Http404, HttpResponseRedirect from django.shortcuts import render from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from sapl.base.models import AppConfig as ConfiguracoesAplicacao from sapl.base.models import CasaLegislativa @@ -202,7 +202,7 @@ def can_vote(context, context_vars, request): def votante_view(request): logger = logging.getLogger(__name__) username = request.user.username if request.user.is_authenticated else 'AnonymousUser' - + # Pega o votante relacionado ao usuário template_name = 'painel/voto_nominal.html' context = {} @@ -215,7 +215,7 @@ def votante_view(request): else: raise ObjectDoesNotExist except ObjectDoesNotExist: - logger.error(f"user={username}. Usuário (user={request.user}) não cadastrado como votante na tela de parlamentares. " + logger.error(f"user={username}. Usuário (user={request.user}) não cadastrado como votante na tela de parlamentares. " "Contate a administração de sua Casa Legislativa!") msg = _("Usuário não cadastrado como votante na tela de parlamentares. Contate a administração de sua Casa Legislativa!") context.update({'error_message': msg}) @@ -365,7 +365,7 @@ def get_presentes(pk, response, materia): else: presentes = SessaoPlenariaPresenca.objects.filter( sessao_plenaria_id=pk) - + sessao = SessaoPlenaria.objects.get(id=pk) num_presentes = len(presentes) data_sessao = sessao.data_inicio @@ -555,7 +555,7 @@ def get_dados_painel(request, pk): if casa and app_config and (bool(casa.logotipo)): brasao = casa.logotipo.url \ if app_config.mostrar_brasao_painel else None - + response = { 'sessao_plenaria': str(sessao), 'sessao_plenaria_data': sessao.data_inicio.strftime('%d/%m/%Y'), @@ -616,7 +616,7 @@ def get_dados_painel(request, pk): (not ultimo_timestamp and last_expediente_leitura): ordem_expediente = last_expediente_leitura.expediente ultimo_timestamp = last_expediente_leitura.data_hora - + if ordem_expediente: return JsonResponse(get_votos( get_presentes(pk, response, ordem_expediente), diff --git a/sapl/parlamentares/apps.py b/sapl/parlamentares/apps.py index 41f6d0b38..bb357afce 100644 --- a/sapl/parlamentares/apps.py +++ b/sapl/parlamentares/apps.py @@ -1,5 +1,5 @@ from django import apps -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class AppConfig(apps.AppConfig): diff --git a/sapl/parlamentares/forms.py b/sapl/parlamentares/forms.py index 89ab424f5..0aa0479b3 100755 --- a/sapl/parlamentares/forms.py +++ b/sapl/parlamentares/forms.py @@ -11,7 +11,7 @@ from django.db import transaction from django.db.models import Q from django.forms import ModelForm from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ import django_filters from image_cropping.widgets import CropWidget, ImageCropWidget diff --git a/sapl/parlamentares/models.py b/sapl/parlamentares/models.py index 42b314ac2..f8c6a065a 100644 --- a/sapl/parlamentares/models.py +++ b/sapl/parlamentares/models.py @@ -1,7 +1,7 @@ from django.db import models from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from image_cropping.fields import ImageCropField, ImageRatioField from model_utils import Choices from prompt_toolkit.key_binding.bindings.named_commands import self_insert diff --git a/sapl/parlamentares/tests/test_parlamentares.py b/sapl/parlamentares/tests/test_parlamentares.py index 4e69cd375..0c0b20038 100644 --- a/sapl/parlamentares/tests/test_parlamentares.py +++ b/sapl/parlamentares/tests/test_parlamentares.py @@ -1,6 +1,6 @@ import pytest from django.urls import reverse -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from model_bakery import baker from sapl.parlamentares.forms import FrenteForm, LegislaturaForm, MandatoForm @@ -314,7 +314,7 @@ def test_legislatura_form_numeros_invalidos(): data_inicio='2002-02-01', data_fim='2005-12-31', data_eleicao='2001-11-01') - + legislatura2 = baker.make(Legislatura, pk=3, numero=3, data_inicio='2008-02-01', diff --git a/sapl/parlamentares/views.py b/sapl/parlamentares/views.py index fca027f01..a1f0beccd 100644 --- a/sapl/parlamentares/views.py +++ b/sapl/parlamentares/views.py @@ -16,7 +16,7 @@ from django.templatetags.static import static from django.urls import reverse, reverse_lazy from django.utils import timezone from django.utils.datastructures import MultiValueDictKeyError -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.views.decorators.clickjacking import xframe_options_exempt from django.views.generic import FormView from django.views.generic.edit import UpdateView diff --git a/sapl/protocoloadm/apps.py b/sapl/protocoloadm/apps.py index 8697e58d9..306ce5f9b 100644 --- a/sapl/protocoloadm/apps.py +++ b/sapl/protocoloadm/apps.py @@ -1,5 +1,5 @@ from django import apps -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class AppConfig(apps.AppConfig): diff --git a/sapl/protocoloadm/forms.py b/sapl/protocoloadm/forms.py index 58223f21c..baf4199d3 100644 --- a/sapl/protocoloadm/forms.py +++ b/sapl/protocoloadm/forms.py @@ -11,7 +11,7 @@ from django.db import transaction from django.db.models import Max from django.forms import ModelForm from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ import django_filters from sapl.base.models import Autor, TipoAutor, AppConfig @@ -388,9 +388,9 @@ class ProtocoloDocumentoForm(ModelForm): (Div(), 2), (Alert( """ - Usuário: {} - {}
+ Usuário: {} - {}
IP: {} - {}
- + """.format( kwargs['initial']['user_data_hora_manual'], Protocolo._meta.get_field( @@ -570,9 +570,9 @@ class ProtocoloMateriaForm(ModelForm): (Div(), 2), (Alert( """ - Usuário: {} - {}
+ Usuário: {} - {}
IP: {} - {}
- + """.format( kwargs['initial']['user_data_hora_manual'], Protocolo._meta.get_field( diff --git a/sapl/protocoloadm/models.py b/sapl/protocoloadm/models.py index 3cdf32735..e947a7d2f 100644 --- a/sapl/protocoloadm/models.py +++ b/sapl/protocoloadm/models.py @@ -3,7 +3,7 @@ import re from django.db import models from django.utils import timezone from django.utils.functional import cached_property -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from model_utils import Choices from sapl.base.models import Autor, AppConfig as SaplAppConfig diff --git a/sapl/protocoloadm/tests/test_protocoloadm.py b/sapl/protocoloadm/tests/test_protocoloadm.py index fe38765c3..9d747f983 100644 --- a/sapl/protocoloadm/tests/test_protocoloadm.py +++ b/sapl/protocoloadm/tests/test_protocoloadm.py @@ -3,7 +3,7 @@ from datetime import date, timedelta from django.urls import reverse from django.utils import timezone from django.utils.encoding import force_text -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from model_bakery import baker from urllib.parse import urlencode import pytest @@ -170,7 +170,7 @@ def test_create_tramitacao(admin_client): msg = force_text(_('A origem da nova tramitação deve ser igual ao ' 'destino da última adicionada!')) - + # Verifica se a origem da nova tramitacao é igual ao destino da última assert msg in response.context_data[ 'form'].errors['__all__'] @@ -508,7 +508,7 @@ def test_lista_documentos_anexados(): ) lista = lista_anexados(documento_principal) - + assert len(lista) == 2 assert lista[0] == documento_anexado assert lista[1] == documento_anexado_anexado @@ -534,7 +534,7 @@ def make_unidade_tramitacao(descricao): return unidade - + @pytest.mark.django_db(transaction=False) def test_tramitacoes_documentos_anexados(admin_client): @@ -636,14 +636,14 @@ def test_tramitacoes_documentos_anexados(admin_client): # Teste Remoção de Tramitacao - url = reverse('sapl.protocoloadm:tramitacaoadministrativo_delete', + url = reverse('sapl.protocoloadm:tramitacaoadministrativo_delete', kwargs={'pk': tramitacao_principal.pk}) response = admin_client.post(url, {'confirmar':'confirmar'} ,follow=True) assert TramitacaoAdministrativo.objects.filter(id=tramitacao_principal.pk).count() == 0 assert TramitacaoAdministrativo.objects.filter(id=tramitacao_anexada.pk).count() == 0 assert TramitacaoAdministrativo.objects.filter(id=tramitacao_anexada_anexada.pk).count() == 0 - - + + # Testes para quando as tramitações das anexadas divergem form = TramitacaoAdmForm(data={}) form.data = {'data_tramitacao':date(2019, 5, 6), @@ -698,7 +698,7 @@ def test_tramitacoes_documentos_anexados(admin_client): assert not tramitacao_anexada_anexada.texto == "Testando a alteração" # Removendo a tramitação pricipal, as tramitações anexadas não devem ser removidas, pois divergiram - url = reverse('sapl.protocoloadm:tramitacaoadministrativo_delete', + url = reverse('sapl.protocoloadm:tramitacaoadministrativo_delete', kwargs={'pk': tramitacao_principal.pk}) response = admin_client.post(url, {'confirmar':'confirmar'} ,follow=True) assert TramitacaoAdministrativo.objects.filter(id=tramitacao_principal.pk).count() == 0 @@ -706,7 +706,7 @@ def test_tramitacoes_documentos_anexados(admin_client): assert TramitacaoAdministrativo.objects.filter(id=tramitacao_anexada_anexada.pk).count() == 1 # Removendo a tramitação anexada, a tramitação anexada à anexada deve ser removida - url = reverse('sapl.protocoloadm:tramitacaoadministrativo_delete', + url = reverse('sapl.protocoloadm:tramitacaoadministrativo_delete', kwargs={'pk': tramitacao_anexada.pk}) response = admin_client.post(url, {'confirmar':'confirmar'} ,follow=True) assert TramitacaoAdministrativo.objects.filter(id=tramitacao_anexada.pk).count() == 0 @@ -752,7 +752,7 @@ def test_tramitacoes_documentos_anexados(admin_client): assert form.is_valid() tramitacao_anexada = form.save() - tramitacao_principal = documento_principal.tramitacaoadministrativo_set.last() + tramitacao_principal = documento_principal.tramitacaoadministrativo_set.last() tramitacao_anexada_anexada = documento_anexado_anexado.tramitacaoadministrativo_set.last() assert documento_principal.tramitacaoadministrativo_set.all().count() == 1 @@ -760,7 +760,7 @@ def test_tramitacoes_documentos_anexados(admin_client): assert not tramitacao_anexada_anexada form = TramitacaoAdmEditForm(data={}) - # Alterando unidade_tramitacao_destino da matéria principal, + # Alterando unidade_tramitacao_destino da matéria principal, # as anexadas não devem ser alteradas form.data = {'data_tramitacao':tramitacao_principal.data_tramitacao, 'unidade_tramitacao_local':tramitacao_principal.unidade_tramitacao_local.pk, @@ -791,7 +791,7 @@ def test_tramitacoes_documentos_anexados(admin_client): form.instance = tramitacao_anexada assert form.is_valid() - tramitacao_anexada = form.save() + tramitacao_anexada = form.save() tramitacao_principal = documento_principal.tramitacaoadministrativo_set.last() tramitacao_anexada_anexada = documento_anexado_anexado.tramitacaoadministrativo_set.last() @@ -801,7 +801,7 @@ def test_tramitacoes_documentos_anexados(admin_client): assert compara_tramitacoes_doc(tramitacao_anexada, tramitacao_principal) # Removendo a tramitação principal, a tramitação anexada não deve ser removida - url = reverse('sapl.protocoloadm:tramitacaoadministrativo_delete', + url = reverse('sapl.protocoloadm:tramitacaoadministrativo_delete', kwargs={'pk': tramitacao_principal.pk}) response = admin_client.post(url, {'confirmar':'confirmar'} ,follow=True) assert TramitacaoAdministrativo.objects.filter(id=tramitacao_principal.pk).count() == 0 @@ -980,7 +980,7 @@ def test_tramitacao_lote_documentos_views(admin_client): # Primeira tramitação em lote - response = admin_client.post(url, + response = admin_client.post(url, {'documentos': documentos, 'data_tramitacao': date(2019, 5, 15), 'unidade_tramitacao_local': unidade_tramitacao_local_1.id, @@ -988,9 +988,9 @@ def test_tramitacao_lote_documentos_views(admin_client): 'status': status.id, 'urgente': False, 'texto': 'aaaa', - 'salvar':'salvar'}, + 'salvar':'salvar'}, follow=True) - + assert response.status_code == 200 assert TramitacaoAdministrativo.objects.all().count() == 2 @@ -1001,10 +1001,10 @@ def test_tramitacao_lote_documentos_views(admin_client): url_lote = reverse('sapl.protocoloadm:tramitacao_em_lote_docadm') url_lote = url_lote + '?' + urlencode( - {'tipo':tipo_documento.id, + {'tipo':tipo_documento.id, 'tramitacaoadministrativo__unidade_tramitacao_destino':unidade_tramitacao_destino_1.id, 'tramitacaoadministrativo__status': status.id, - 'data_0':'', + 'data_0':'', 'data_1':''}) response = admin_client.post(url_lote, {'salvar':'salvar'}, follow=True) @@ -1026,7 +1026,7 @@ def test_tramitacao_lote_documentos_views(admin_client): assert 'Status: Este campo é obrigatório.' in msgs assert 'Unidade Destino: Este campo é obrigatório.' in msgs assert 'Texto da Ação: Este campo é obrigatório.' in msgs - + response = admin_client.post(url_lote, {'documentos': documentos, 'data_tramitacao': date(2019, 5, 15), @@ -1035,7 +1035,7 @@ def test_tramitacao_lote_documentos_views(admin_client): 'status': status.id, 'urgente': False, 'texto': 'aaaa', - 'salvar':'salvar'}, + 'salvar':'salvar'}, follow=True) assert response.status_code == 200 @@ -1051,7 +1051,7 @@ def test_tramitacao_lote_documentos_views(admin_client): # O documento anexado ao anexado não deve tramitar junto porque já está com tramitação diferente documentos = [documento_principal.id] - response = admin_client.post(url, + response = admin_client.post(url, {'documentos': documentos, 'data_tramitacao': date(2019, 5, 15), 'unidade_tramitacao_local': unidade_tramitacao_local_1.id, @@ -1059,9 +1059,9 @@ def test_tramitacao_lote_documentos_views(admin_client): 'status': status.id, 'urgente': False, 'texto': 'aaaa', - 'salvar':'salvar'}, + 'salvar':'salvar'}, follow=True) - + assert response.status_code == 200 assert TramitacaoAdministrativo.objects.all().count() == 6 @@ -1077,7 +1077,7 @@ def test_tramitacao_lote_documentos_views(admin_client): 'status': status.id, 'urgente': False, 'texto': 'aaaa', - 'salvar':'salvar'}, + 'salvar':'salvar'}, follow=True) assert response.status_code == 200 @@ -1090,7 +1090,7 @@ def test_tramitacao_lote_documentos_views(admin_client): assert documento_anexado.tramitacaoadministrativo_set.all().count() == 2 # Terceira tramitação em lote - # Agora, o documento anexado ao anexado deve tramitar junto com o documento principal, + # Agora, o documento anexado ao anexado deve tramitar junto com o documento principal, # pois suas tramitações convergiram response = admin_client.post(url_lote, @@ -1101,7 +1101,7 @@ def test_tramitacao_lote_documentos_views(admin_client): 'status': status.id, 'urgente': False, 'texto': 'aaaa', - 'salvar':'salvar'}, + 'salvar':'salvar'}, follow=True) assert response.status_code == 200 @@ -1128,7 +1128,7 @@ def test_tramitacao_lote_documentos_views(admin_client): # O documento anexado não deve tramitar junto com o prinicpal documentos = [documento_principal.id] - response = admin_client.post(url, + response = admin_client.post(url, {'documentos': documentos, 'data_tramitacao': date(2019, 5, 15), 'unidade_tramitacao_local': unidade_tramitacao_local_1.id, @@ -1136,9 +1136,9 @@ def test_tramitacao_lote_documentos_views(admin_client): 'status': status.id, 'urgente': False, 'texto': 'aaaa', - 'salvar':'salvar'}, + 'salvar':'salvar'}, follow=True) - + assert response.status_code == 200 assert TramitacaoAdministrativo.objects.all().count() == 1 @@ -1149,7 +1149,7 @@ def test_tramitacao_lote_documentos_views(admin_client): # Tramitar o doc anexado ao principal para testar a segunda tramitação em lote documentos = [documento_anexado.id] - response = admin_client.post(url, + response = admin_client.post(url, {'documentos': documentos, 'data_tramitacao': date(2019, 5, 15), 'unidade_tramitacao_local': unidade_tramitacao_local_1.id, @@ -1157,9 +1157,9 @@ def test_tramitacao_lote_documentos_views(admin_client): 'status': status.id, 'urgente': False, 'texto': 'aaaa', - 'salvar':'salvar'}, + 'salvar':'salvar'}, follow=True) - + assert response.status_code == 200 assert TramitacaoAdministrativo.objects.all().count() == 2 @@ -1181,7 +1181,7 @@ def test_tramitacao_lote_documentos_views(admin_client): 'status': status.id, 'urgente': False, 'texto': 'aaaa', - 'salvar':'salvar'}, + 'salvar':'salvar'}, follow=True) assert response.status_code == 200 diff --git a/sapl/protocoloadm/views.py b/sapl/protocoloadm/views.py index 38ffcf42a..a8dfc2ef0 100755 --- a/sapl/protocoloadm/views.py +++ b/sapl/protocoloadm/views.py @@ -24,7 +24,7 @@ from django.shortcuts import redirect, get_object_or_404 from django.shortcuts import render from django.urls import reverse from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.views.generic import ListView, CreateView, UpdateView from django.views.generic.base import RedirectView, TemplateView from django.views.generic.edit import FormView diff --git a/sapl/redireciona_urls/apps.py b/sapl/redireciona_urls/apps.py index 8ee8742bc..ae4ea82e7 100644 --- a/sapl/redireciona_urls/apps.py +++ b/sapl/redireciona_urls/apps.py @@ -1,5 +1,5 @@ from django import apps -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class AppConfig(apps.AppConfig): diff --git a/sapl/relatorios/apps.py b/sapl/relatorios/apps.py index 9e560eb1c..5a4fe84be 100644 --- a/sapl/relatorios/apps.py +++ b/sapl/relatorios/apps.py @@ -1,5 +1,5 @@ from django import apps -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class AppConfig(apps.AppConfig): diff --git a/sapl/relatorios/forms.py b/sapl/relatorios/forms.py index 59eb2d741..9dbadf928 100644 --- a/sapl/relatorios/forms.py +++ b/sapl/relatorios/forms.py @@ -3,7 +3,7 @@ from crispy_forms.bootstrap import (FormActions) from crispy_forms.layout import (HTML, Button, Fieldset, Layout, Submit) from django import forms -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from sapl.audiencia.models import AudienciaPublica from sapl.base.models import Autor diff --git a/sapl/relatorios/views.py b/sapl/relatorios/views.py index 99a299abb..3d00dc2d9 100755 --- a/sapl/relatorios/views.py +++ b/sapl/relatorios/views.py @@ -10,7 +10,7 @@ from django.db.models import Count, Q, F from django.http import Http404, HttpResponse from django.template.loader import render_to_string from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.views.generic import TemplateView, ListView from django_filters.views import FilterView from weasyprint import HTML, CSS diff --git a/sapl/rules/__init__.py b/sapl/rules/__init__.py index 7984f6ef5..8073910a1 100644 --- a/sapl/rules/__init__.py +++ b/sapl/rules/__init__.py @@ -1,4 +1,4 @@ -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ default_app_config = 'sapl.rules.apps.AppConfig' diff --git a/sapl/rules/apps.py b/sapl/rules/apps.py index cdaa71516..2c1b5e067 100644 --- a/sapl/rules/apps.py +++ b/sapl/rules/apps.py @@ -8,7 +8,7 @@ from django.contrib.auth.management import _get_all_permissions from django.core import exceptions from django.db import models, router from django.db.utils import DEFAULT_DB_ALIAS -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from sapl.rules import (SAPL_GROUP_ADMINISTRATIVO, SAPL_GROUP_COMISSOES, SAPL_GROUP_GERAL, SAPL_GROUP_MATERIA, SAPL_GROUP_NORMA, diff --git a/sapl/rules/tests/test_rules.py b/sapl/rules/tests/test_rules.py index 75baaacc9..246ed0ba7 100644 --- a/sapl/rules/tests/test_rules.py +++ b/sapl/rules/tests/test_rules.py @@ -3,7 +3,7 @@ from django.conf import settings from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from django.utils import six -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ import pytest from sapl.base.models import CasaLegislativa diff --git a/sapl/sessao/apps.py b/sapl/sessao/apps.py index 281847b56..7d5b2243b 100644 --- a/sapl/sessao/apps.py +++ b/sapl/sessao/apps.py @@ -1,5 +1,5 @@ from django import apps -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class AppConfig(apps.AppConfig): diff --git a/sapl/sessao/forms.py b/sapl/sessao/forms.py index 73ac911f0..2cbad7c0a 100644 --- a/sapl/sessao/forms.py +++ b/sapl/sessao/forms.py @@ -10,7 +10,7 @@ from django.db import transaction from django.db.models import Q from django.forms import ModelForm from django.forms.widgets import CheckboxSelectMultiple -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ import django_filters from sapl.base.models import Autor, TipoAutor diff --git a/sapl/sessao/models.py b/sapl/sessao/models.py index 55fe581a1..83c3c23f7 100644 --- a/sapl/sessao/models.py +++ b/sapl/sessao/models.py @@ -4,7 +4,7 @@ from django.core.exceptions import ValidationError from django.db import models from django.db.models import Q, F from django.utils import timezone, formats -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from model_utils import Choices from sapl.base.models import Autor diff --git a/sapl/sessao/tests/test_sessao.py b/sapl/sessao/tests/test_sessao.py index 0f42465e5..dee33f3cc 100644 --- a/sapl/sessao/tests/test_sessao.py +++ b/sapl/sessao/tests/test_sessao.py @@ -1,7 +1,7 @@ import pytest from datetime import datetime from django.core.exceptions import ValidationError -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from model_bakery import baker from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa diff --git a/sapl/sessao/tests/test_sessao_view.py b/sapl/sessao/tests/test_sessao_view.py index 00284465b..bf81f5c5c 100644 --- a/sapl/sessao/tests/test_sessao_view.py +++ b/sapl/sessao/tests/test_sessao_view.py @@ -1,6 +1,6 @@ import pytest from django.urls import reverse -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from model_bakery import baker from sapl.parlamentares.models import Legislatura, SessaoLegislativa @@ -13,7 +13,7 @@ from sapl.sessao.models import (SessaoPlenaria, TipoSessaoPlenaria, from sapl.parlamentares.models import Parlamentar, CargoMesa, Filiacao from sapl.sessao.views import (get_identificacao_basica, get_conteudo_multimidia, - get_mesa_diretora, get_presenca_sessao, + get_mesa_diretora, get_presenca_sessao, get_expedientes, get_materias_expediente, get_oradores_expediente, get_presenca_ordem_do_dia, get_materias_ordem_do_dia, get_oradores_explicacoes_pessoais, @@ -78,11 +78,11 @@ class TestResumoView(): id_basica = get_identificacao_basica(self.sessao_plenaria) info_basica = id_basica['basica'] assert info_basica[0] == 'Tipo de Sessão: ' + str(self.sessao_plenaria.tipo) - + data_inicio = self.sessao_plenaria.data_inicio abertura = data_inicio.strftime('%d/%m/%Y') if data_inicio else '' assert info_basica[1] == 'Abertura: ' + abertura +' - '+ self.sessao_plenaria.hora_inicio - + data_fim = self.sessao_plenaria.data_fim encerramento = data_fim.strftime('%d/%m/%Y') + ' -' if data_fim else '' assert info_basica[2] == 'Encerramento: ' + encerramento +' '+ self.sessao_plenaria.hora_fim @@ -102,11 +102,11 @@ class TestResumoView(): def test_get_mesa_diretora(self): mesa = get_mesa_diretora(self.sessao_plenaria) - assert mesa == {'mesa':[{ + assert mesa == {'mesa':[{ 'cargo': self.cargo_mesa, 'parlamentar': self.parlamentar }]} - + def test_get_presenca_sessao(self): justificativa = baker.make(JustificativaAusencia,sessao_plenaria=self.sessao_plenaria) presenca = baker.make(SessaoPlenariaPresenca,sessao_plenaria=self.sessao_plenaria) @@ -114,7 +114,7 @@ class TestResumoView(): resposta_presenca = get_presenca_sessao(self.sessao_plenaria) assert resposta_presenca['presenca_sessao'] == [presenca.parlamentar] assert resposta_presenca['justificativa_ausencia'][0] == justificativa - + def test_get_expedientes(self): tipo_expediente = baker.make(TipoExpediente) expediente = baker.make(ExpedienteSessao,sessao_plenaria=self.sessao_plenaria,tipo=tipo_expediente) @@ -123,7 +123,7 @@ class TestResumoView(): assert resposta_expediente['expedientes'] == [{ 'conteudo': expediente.conteudo, - 'tipo': tipo_expediente + 'tipo': tipo_expediente }] def test_get_materias_expediente(self): diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index c4b092f52..b01759ebc 100755 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -19,7 +19,7 @@ from django.utils.datastructures import MultiValueDictKeyError from django.utils.decorators import method_decorator from django.utils.encoding import force_text from django.utils.html import strip_tags -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.views.decorators.csrf import csrf_exempt from django.views.generic import (FormView, ListView, TemplateView) from django.views.generic.base import RedirectView diff --git a/sapl/test_urls.py b/sapl/test_urls.py index b01baec1b..b6c1f14aa 100644 --- a/sapl/test_urls.py +++ b/sapl/test_urls.py @@ -4,7 +4,7 @@ from django.contrib.auth.management import _get_all_permissions from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from django.db import transaction -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ import pytest from sapl.crud.base import PermissionRequiredForAppCrudMixin diff --git a/sapl/utils.py b/sapl/utils.py index 0733d8152..8197faeb5 100644 --- a/sapl/utils.py +++ b/sapl/utils.py @@ -35,7 +35,7 @@ from django.forms.widgets import SplitDateTimeWidget, ClearableFileInput from django.http.response import JsonResponse, HttpResponse from django.utils import six, timezone from django.utils.safestring import mark_safe -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ import django_filters from easy_thumbnails import source_generators import magic